[Solved] How to create reminders that don’t have to be shown in the Apple’s Reminders app


Just for the record, what I was looking for was User Notifications.

Here is a complete example.

User Notifications

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
        if granted{
            print("User gave permissions for local notifications")
        }else{
            print("User did NOT give permissions for local notifications")
        }
    }
    return true
}


 override func viewDidLoad() {
    super.viewDidLoad()
    setReminderAtTime()
} 

func setReminderAtTime(){
    let reminderTime:TimeInterval = 60

    let center = UNUserNotificationCenter.current()
    center.removeAllPendingNotificationRequests()
    
    let content =  UNMutableNotificationContent()
    content.title = "Title"
    content.body = "Notification Message!."
    content.sound = .default
    
    let trigger =  UNTimeIntervalNotificationTrigger(timeInterval: reminderTime, repeats: false)
    let request = UNNotificationRequest(identifier: "reminderName", content: content, trigger: trigger)
    
    center.add(request) { (error) in
        if error != nil{
            print("Error = \(error?.localizedDescription ?? "error local notification")")
        }
    }
}

2

solved How to create reminders that don’t have to be shown in the Apple’s Reminders app