Post

Replies

Boosts

Views

Activity

Reply to Custom URL opening app, but not passing information
For future stumblers: When the app is killed and opened by a custom URI, it doesn't trigger func scene(_:openURLContexts:) but by the normal startup function func scene(_:willConnectTo:options) where connectionOptions contains your urlContexts. func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { &#9;&#9;let myRootController = Controller() &#9;&#9; &#9;&#9;window.rootViewController = myRootController &#9;&#9;self.window = window &#9;&#9;window.makeKeyAndVisible() &#9;&#9;self.handle(urlContexts) } func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) { &#9;&#9;self.handle(connectionOptions.urlContexts) } private func handle(_ urlContexts: Set<UIOpenURLContext>) { &#9;&#9;if let url = urlContexts.first?.url{ &#9;&#9;&#9;&#9;@Binding var _: String = url.absoluteString &#9;&#9;&#9;&#9;print(url.absoluteString) &#9;&#9;&#9;&#9;Controller.message = url.absoluteString &#9;&#9;&#9;&#9;print(Controller.message) } }
Dec ’20