I have List in Content View & List is connected to Detail View by Navigation Link. I am using User Notifications with SwiftUI I want to automatically redirect to Detail View when tapped on Notification
From App Delegate:
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let application = UIApplication.shared
// Show on Tap
application.applicationIconBadgeNumber = 0
if application.applicationState == .inactive {
let detailView = DetailView(item: DummyData[1])
if let window = UIApplication.shared.keyWindow {
self.window = window
}
self.window?.rootViewController = UIHostingController(rootView: detailView)
self.window?.makeKeyAndVisible()
}
completionHandler()
}
This code is showing Detail View, but unable to Navigate through the app (Navigation View).
How to redirect to detail view when tapped on Notification like WhatsApp, Instagram using SwiftUI?