Это грубая версия решения, которое вы ищете, конечно, вы можете добавить больше проверок, например, в зависимости от полезной нагрузки уведомлений (userInfo) вы можете перейти на разные контроллеры.
extension AppDelegate: UNUserNotificationCenterDelegate {
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.alert, .badge, .sound])
}
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let storyboard = UIStoryboard(name: "yourStoryboardName", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: "yourControllerName")
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
}
@available(iOS 9, *)
func application(_ application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable : Any], withResponseInfo responseInfo: [AnyHashable : Any], completionHandler: @escaping () -> Void) {
let storyboard = UIStoryboard(name: "yourStoryboardName", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: "yourControllerName")
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
completionHandler()
}
}