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:
https://developer.apple.com/documentation/uikit/uiapplication/openurloptionskey/1623128-sourceapplication
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?
Post
Replies
Boosts
Views
Activity
I'm looking for an accessibility modifier (or some other method) in SwiftUI that does the same job as UIKit's accessibilityLanguage property:
https://developer.apple.com/documentation/objectivec/nsobject/1615192-accessibilitylanguage
We've got a few screens in our app for which the display language is server-dictated instead of device-dictated -- and without this property VoiceOver is reading Spanish with the English parser and accent when the device is set to English.
Thanks for any information.
Does the default Swift string interpolation (example: "Orange count: (76341)") always output in the "en_US_POSIX" locale (or equivalent)? Or does it depend on the user's locale?
For example, using a number formatter with a locale of "fa_IR" produces: "۷۶۳۴۱" (for 76341).
I'm curious to know if there's any way a user's locale or language settings can affect the "default" string interpolation, since we use that often to set values in headers to web servers, and those have to be in English numbers.
Can I safely use default string interpolation for that or should I use an explicit number formatter (with "en_US_POSIX") to be sure?