I am looking to create a local notification system where the text it displays is different than the text it contains at request. I'm not looking to modify the notification from the standard Title, Body format. To test this, I tried to create a notification showing the current date, but when it was displayed, the time shown was two minutes ago. Is it possible to have this notification show the current date and time (or other variable content) without push notifications?
let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy MM dd HH mm ss"
let dateString = dateFormatter.string(from: date)
let content = UNMutableNotificationContent()
content.title = "Title"
content.body = "the date is \(date)"
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 120, repeats: false)
let request = UNNotificationRequest(identifier: "TestIdentifier", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)