URLConfigurationProvider
open class URLConfigurationProvider : ConfigurationProviding, AppDelegateObserving
extension URLConfigurationProvider: SceneDelegateObserving
This class is used with the ConfigurationLoader
class.
Uses the Apple Universal Links functionality to obtain and provide the configuration information for the application to use.
If your app supports Appdelegate to handle App life cycle, application(_:continue:restorationHandler:)
AppDelegate method acquire the necessary URL as described in Apple documentation.
Use the AppDelegateDispatcher
class to broadcast the invocation of said delegate for this class.
The corresponding AppDelegate method is invoked right after the return of didFinishLaunchingWithOptions
. This configuration provider needs to exist by that time, so instantiate it before returning from that method.
You need to register and unregister this provider as AppDelegateObserving to avoid memory leaks - see code example below.
// ... in the UIApplicationDelegate file
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
AppDelegateDispatcher.register(provider)
let result = AppDelegateDispatcher.application(application, continue: userActivity, restorationHandler: restorationHandler)
AppDelegateDispatcher.unregister(provider)
return result
}
In case of SceneDelegate, scene(_:openURLContexts:)
SceneDelegate method acquire the necessary URL as described in Apple documentation.
Use the SceneDelegateDispatcher
class to broadcast the invocation of said delegate for this class.
The corresponding SceneDelegate method is invoked right after the return of didFinishLaunchingWithOptions
. This configuration provider needs to exist by that time, so instantiate it before returning from that method.
You need to register and unregister this provider as SceneDelegateObserving to avoid memory leaks - see code example below.
// ... in the UIWindowSceneDelegate file
func scene(_ scene: UIScene, continue userActivity: NSUserActivity){
SceneDelegateDispatcher.register(provider)
SceneDelegateDispatcher.scene(scene, continue: userActivity)
SceneDelegateDispatcher.unregister(provider)
}
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
SceneDelegateDispatcher.register(provider)
SceneDelegateDispatcher.scene(scene, willConnectTo: session, options: connectionOptions)
SceneDelegateDispatcher.unregister(provider)
}
-
Static parameter key name in the URL query for the ‘host’ value.
Declaration
Swift
public static let hostParameterName: String
-
Static parameter key name in the URL query for the ‘port’ value.
Declaration
Swift
public static let portParameterName: String
-
Static parameter key name in the URL query for the ‘protocol’ value.
Declaration
Swift
public static let protocolParameterName: String
-
Static parameter key name in the URL query for the ‘authType’ value.
Declaration
Swift
public static let authTypeParameterName: String
-
Static parameter key name in the URL query for the ‘tokenEndpoint’ value.
Declaration
Swift
public static let tokenEndpointParameterName: String
-
Static parameter key name in the URL query for the ‘authorizationEndpoint’ value.
Declaration
Swift
public static let authorizationEndpointParameterName: String
-
Static parameter key name in the URL query for the ‘oauthEndUserUI’ value.
Declaration
Swift
public static let oauthEndUserUIParameterName: String
-
Static parameter key name in the URL query for the ‘clientID’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.
Declaration
Swift
public static let oauthClientIDParameterName: String
-
Static parameter key name in the URL query for the ‘redirectURL’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.
Declaration
Swift
public static let oauthRedirectURLParameterName: String
-
Static parameter key name in the URL query for the ‘grantType’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.
Declaration
Swift
public static let oauthGrantTypeParameterName: String
-
Static parameter key name in the URL query for the ‘passcode’ value. There could be multiple values identified by a counter which is substituted to the place marked with ‘%@’.
Declaration
Swift
public static let oauthPasscodeParameterName: String
-
Static parameter key name in the URL query for the ‘authChallengeHeader’ value.
Declaration
Swift
public static let authChallengeHeaderParameterName: String
-
Static parameter key name in the URL query for the ‘endpointUri’ value.
Declaration
Swift
public static let endpointUriParameterName: String
-
Static parameter key name in the URL query for the ‘redirectParam’ value.
Declaration
Swift
public static let redirectParamParameterName: String
-
The provider identifier.
Declaration
Swift
public var providerIdentifier: String
-
The expected input for the provider - which is empty.
Declaration
Swift
public var expectedInput: [String : Any]
-
The default timeout the provider waits when the universal link is not present at the time of the provideConfiguration call.
Declaration
Swift
public let defaultTimeout: Double
-
Instantiates the provider
Declaration
Swift
public init(defaultTimeout: Double = 1)
Parameters
defaultTimeout
The default timeout the provider waits when the universal link is not present at the time of the provideConfiguration call. By default it is “.now() + 1”
-
Declaration
Swift
public func provideConfiguration(input: [String : Any]) -> (providerSuccess: Bool, configuration: NSDictionary, returnError: Error?)
-
The AppDelegate call where the URL is received could happen later in time, than this function call.
Declaration
Swift
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool
-
Declaration
Swift
public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
-
Checks if the URL from the App delegate/ Scene delegate methods is indeed a configuration URL. By default it checks if the url has one of the following templates: https://
/mobileservices/deeplinks/ /config https:// /config Declaration
Swift
open func isConfigurationURL(_ url: URL) -> Bool
-
Declaration
Swift
public func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
-
Declaration
Swift
public func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
-
Declaration
Swift
public func scene(_ scene: UIScene, continue userActivity: NSUserActivity)