BTAppContextSwitcher
@objcMembers
public class BTAppContextSwitcher : NSObject
Handles return URLs when returning from app context switch and routes the return URL to the correct app context switch client class.
Note
returnURLScheme
must contain your app’s registered URL Type that starts with the app’s bundle ID.
When your app returns from app switch, the app delegate should call handleOpenURL
(or handleOpen
if not using SceneDelegate)
-
Singleton for shared instance of
BTAppContextSwitcher
Declaration
Swift
public static let sharedInstance: BTAppContextSwitcher
-
The URL scheme to return to this app after switching to another app or opening a SFSafariViewController. This URL scheme must be registered as a URL Type in the app’s info.plist, and it must start with the app’s bundle ID.
Note
This property should only be used for the Venmo flow.Declaration
Swift
@available(*, deprecated, message: "returnURLScheme is deprecated and will be removed in a future version. Use BTVenmoClient(apiClient:universalLink:﹚.") public var returnURLScheme: String { get set }
-
Determine whether the return URL can be handled.
Declaration
Swift
@discardableResult @objc(handleOpenURLContext:) public func handleOpenURL(context: UIOpenURLContext) -> Bool
Return Value
true
when the SDK can process the return URL -
Complete payment flow after returning from app or browser switch.
Declaration
Swift
@discardableResult @objc(handleOpenURL:) public func handleOpen(_ url: URL) -> Bool
Parameters
url
The URL you receive in
scene:openURLContexts:
(orapplication:openURL:options:
if not using SceneDelegate)Return Value
true
when the SDK has handled the URL successfully -
Registers a class
Type
that can handle a return from app context switch with a static method.Declaration
Swift
@objc(registerAppContextSwitchClient:) public func register(_ client: BTAppContextSwitchClient.Type)
Parameters
client
A class
Type
that implementsBTAppContextSwitchClient
, the methods of which will be invoked statically on the class.