Reputation: 905
I am working on SwiftUI app in which trying to perform deep linking. when I manually open the browser and put "myapp://" its navigating to app correctly. But in actual I am opening safari within app and after deep link success I want to call below appdelegate method
I am using sfsafariviewcontroller
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
print("myapp")
return true
}
below is my work
Thank You for help
Upvotes: 2
Views: 1291
Reputation: 11
@main
struct SomeApp: App {
var body: some Scene{
WindowGroup{
Content()
.onOpenURL{url in
//handle any action from deep link
}
}
}
}
struct Content: View {
var body: some View {
Text("Hello World")
}
}
After set deeplink in info.plist you can handle deeplink via method onOpenURL
Upvotes: 1