title: how to repeat local notification if not perform any action in swift
body: <p>I am implementing a code for local notifications. My app shows notification and it has two buttons and both buttons have some specific action. Now i want to do when notification will show and user ignore the notification and not click on any button, then it should repeat the notification after one minute. please tell me how to do this.</p>
  
  <pre><code>import UIKit
  import UserNotifications
  
  
  class ViewController: UIViewController, UNUserNotificationCenterDelegate {
  
      var isGrantedAccess = false
      let time:TimeInterval = 10.0
      var triggered = false
  
      @IBOutlet weak var checkinDateLbl: UILabel!
      override func viewDidLoad() {
          super.viewDidLoad()
          UNUserNotificationCenter.current().delegate = self
          UNUserNotificationCenter.current().requestAuthorization(
              options: [.alert,.sound,.badge],
              completionHandler: { (granted,error) in
                  self.isGrantedAccess = granted
                  if granted{
                      self.setCategories()
                  } else {
                      let alert = UIAlertController(title: "Notification Access", message: "In order to use this application, turn on notification permissions.", preferredStyle: .alert)
                      let alertAction = UIAlertAction(title: "Okay", style: .default, handler: nil)
                      alert.addAction(alertAction)
                      self.present(alert , animated: true, completion: nil)
                  }
          })
  
      }
  
  
      @IBAction func saveBtn(_ sender: Any) {
  
          let checkin = checkinDateLbl.text
          if checkin == "0000-00-00 00:00:00" {
              if isGrantedAccess{
                  let content = UNMutableNotificationContent()
                  content.title = "Attendance Alert"
                  content.body = "Please Check In"
                  content.sound = UNNotificationSound.default()
                  content.categoryIdentifier = "alarm.category"
  
  
                  var datee = DateComponents()
                  datee.hour = 21
                  datee.minute = 50
                  let triggerDate = UNCalendarNotificationTrigger(dateMatching: datee, repeats: true)
                  addNotification(content: content, trigger: triggerDate , indentifier: "Alarm")
  
  
  
  
              }
          }
      }
  
      //MARK: - Functions
      func setCategories(){
          let snoozeAction = UNNotificationAction(identifier: "snooze", title: "Notify after 30 Minutes", options: [])
          let commentAction = UNTextInputNotificationAction(identifier: "comment", title: "Ignore", options: [])
          let alarmCategory = UNNotificationCategory(identifier: "alarm.category",actions: [snoozeAction,commentAction],intentIdentifiers: [], options: [])
          UNUserNotificationCenter.current().setNotificationCategories([alarmCategory])
      }
  
      func addNotification(content:UNNotificationContent,trigger:UNNotificationTrigger?, indentifier:String){
          let request = UNNotificationRequest(identifier: indentifier, content: content, trigger: trigger)
          UNUserNotificationCenter.current().add(request, withCompletionHandler: {
              (errorObject) in
              if let error = errorObject{
                  print("Error \(error.localizedDescription) in notification \(indentifier)")
              }
          })
  
      }
  
      // MARK: - Delegates
      func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void) {
          completionHandler([.alert,.sound])
      }
      func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void) {
          let identifier = response.actionIdentifier
          let request = response.notification.request
  
  
  
          if identifier == "snooze"{
              let newContent = request.content.mutableCopy() as! UNMutableNotificationContent
              newContent.title = "Notification"
              newContent.body = "hi"
  
  
  
              let newTrigger = UNTimeIntervalNotificationTrigger(timeInterval: time, repeats: true)
              addNotification(content: newContent, trigger: newTrigger, indentifier: request.identifier)
  
  
  
  
          }
  
  //        if identifier == "comment"{
  //            UNUserNotificationCenter.current().removeAllDeliveredNotifications()
  //
  //        }
  
          completionHandler()
      }
  
  }
  </code></pre>