I would like the notification to stay.
I have inter alia following code, it works well but the notification disappears after 5 seconds (both when app is running or terminated):
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let nc = UNUserNotificationCenter.current()
nc.delegate = self
return true
}
public func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let request = notification.request
let identifier = request.identifier
let userInfo = notification.request.content.userInfo
completionHandler([.banner, .list, .badge, .sound])
}