Until now we were able to handle custom URL schemes that launch the app using AppDelegate
or SceneDelegate
. But how is this possible using the new lifecycle?
I tried adding an @UIApplicationDelegateAdaptor
with the application:openURL:options:
function but that is never called. The closest I've got is using the Environment's scenePhase but that only tells the state of the scene (active, background etc.), not the incoming URL.
You can use the onOpenURL(perform:)
modifier either in the body of you App
or Scene
or on views in your hierachy. The modifier gets called multiple times as well, so you could set the state for each view individually. With that your AppDelegate
no longer needs to know your whole navigagion, which is great.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With