In the old SwiftUI app initialization there was UIApplicationDelegate and UIWindowSceneDelegate.
I was handling a URL callback in the SceneDelegate using the method:
However in the new app initialization there is no SceneDelegate, nor an appropriate property like there is UIApplicationDelegateAdaptor for UIApplicationDelegate
I tried using the method but it is not called.
So my question is, how do I handle a callback url in the new app setup?
I was handling a URL callback in the SceneDelegate using the method:
Code Block func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
However in the new app initialization there is no SceneDelegate, nor an appropriate property like there is UIApplicationDelegateAdaptor for UIApplicationDelegate
I tried using the method but it is not called.
Code Block func application( _ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool
So my question is, how do I handle a callback url in the new app setup?
You can use the onOpenURL(perform:) view modifier. https://developer.apple.com/documentation/swiftui/outlinesubgroupchildren/onopenurl(perform:)
Code Block var body: some Scene { WindowGroup { ContentView() .onOpenURL { (url) in // Handle url here } } }