Using the UIKit application lifecycle and this delegate method
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
I can access options associated with a user tapping on a custom URL. In particular I can access the bundle ID of another app of mine that triggered a custom URL to launch the target app via this property:
When I output the "options" parameter after triggering I can see the bundle ID clearly for UIApplicationOpenURLOptionsSourceApplicationKey:
options: [__C.UIApplicationOpenURLOptionsKey(_rawValue: UIApplicationOpenURLOptionsSourceApplicationKey): COM.MYDOMAIN.TestURL2, __C.UIApplicationOpenURLOptionsKey(_rawValue: UIApplicationOpenURLOptionsOpenInPlaceKey): 0]
However, when using the SwiftUI application lifecycle the above app delegate function is not called in favor of the SwiftUI view extension:
onOpenURL(perform action: @escaping (URL) -> ()) -> some View
This has only the custom URL and no other options and thus I cannot find a way to find out which of my other apps triggered the target app via a custom URL.
Does anyone know if there's a way to get this information in an app that uses the SwiftUI app lifecycle or is it not available except in an app that uses the UIKit application lifecycle?
Hi @Purseus ,
With SwiftUI, only onOpenURL will be called, even if you do have an app delegate adaptor. You will not be able to get that information, you're correct.
Please file a feedback report about this at https://feedbackassistant.apple.com , I've seen many people asking for this behavior on here and the more people that request it, the better. Paste the FB number here after. Thanks!