1

I'd like pressing a notification to open up a certain page in the SwiftUI app. I'm able to trigger the print statement "notification was tapped" when the notification is tapped by having this code in the AppDelegate.swift

extension AppDelegate: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.alert, .sound, .badge]) } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { print("notification was tapped") // add code to open specific swiftUI view here! completionHandler() } } 

How can control the view that will be opened from the AppDelegate.swift?

1

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.