How to handle opening a URL to load a specific app screen?
Here's my solution to this issue:
struct myApp: App {
@ObservedObject var authenticator = Authenticator.shared
@State var route: URL?
@State var urlToken: String?
var body: some Scene {
WindowGroup {
RootView(url: route)
.onOpenURL { url in
self.route = url
if url.pathComponents.contains("reset"), let token = url.queryDictionary?["token"] {
self.urlToken = token
}
}
.fullScreenCover(item: $urlToken) { _ in
NavigationView {
PasswordResetView(viewModel: .init(onFinish: {
route = nil
urlToken = nil
}))
.onAppear {
self.authenticator.accessToken = urlToken
}
}
}
}
}
}
struct RootView: View {
@ObservedObject var authenticator = Authenticator.shared
var body: some View {
if authenticator.accessToken != nil {
MainTabView()
} else {
NavigationView {
FirstView()
}
}
}
}
What is deep link and how i can create it for App Store?
This is known as 'deferred deep linking'. It's complicated to build — I don't recommend trying to do it yourself. Take a look at free services like Branch.io (full disclosure: I'm on the Branch team) or Firebase Dynamic Links.
Firebase dynamic link not working with Testflight IOS
Hey I had the same problem. Have a look at your associated domains (Xcode build settings) for all configurations and make sure they match Firebase.
Mine had a wrong one for DevRelease configuration(which is TestFlight)
Related Topics
iOS Enterprise Provisioning Profile Expiration
The Simulator Can't Be Launched Because It Is Already in Use
Share Video on Twitter with Fabric API Without Composer iOS
Passing Data Between 2 Uiviewcontroller Using Delegate and Protocol
Swift: Custom Camera Save Modified Metadata with Image
Watchkit: Unable to Find Interface Controller Class
How to Do Something Before Unwind Segue Action
Combining Text and Images in 'Uitextview'
How to Access iOS Private APIs in Swift
Uidatepicker Bug? Uicontroleventvaluechanged After Hitting Minimum Internal
Change App Language in iOS Without Restarting the App
How to Create Custom View Programmatically in Swift Having Controls Text Field, Button etc
Orienting iOS Splash Image to Landscape/Portrait According to Launch Orientation
Intercept Request with Wkwebview
Save Eventually on Pfobject with Pffile (Parse Local Datastore)