Reputation: 411
I'm using SwiftUI language
I click on a notification and redirect to the home screen, but I need a detailed screen in a redirection.
This is my set root code.. how to set here detail screen using SwiftUI language
if(application.applicationState == .inactive)
{
// let storyboard = UIStoryboard(name: "Main", bundle: nil)
let contentView = ContentView1()
if let window = UIApplication.shared.keyWindow {
self.window = window
}
self.window?.rootViewController = UIHostingController(rootView: contentView)
self.window?.makeKeyAndVisible()
print("user tapped the notification bar when the app is in background")
}
Upvotes: 2
Views: 1841
Reputation: 4608
You can use a NavigationView
and in it put NavigationLink(_,destination:,tag:,selection:)
where selection
is bound to a value that will match the notification received.
For a detailed explanation and example code, see https://nalexn.github.io/swiftui-deep-linking/ .
Upvotes: 2