ConnectController
@objcMembers
@MainActor
public class ConnectController : UIViewController, WKNavigationDelegate
A view controller responsible for:
- Initializing and presenting the WKWebView.
- Detecting redirects back to the application (via
webView(_:decidePolicyFor:decisionHandler:)). - Invoking the callback closure when the application redirect is encountered.
-
Undocumented
Declaration
Swift
@MainActor public var webView: WKWebView! -
Initializes the ConnectController.
Declaration
Swift
@MainActor public init(authUrl: URL, redirectUriHost: String, handleCallback: @escaping (URL) -> Void)Parameters
authUrlThe Connect URL to open in the WKWebView.
redirectUriHostHost of the redirect URI that was passed to SmartcarAuth.
handleCallbackCallback function that is invoked upon redirect back to the application.
-
Undocumented
Declaration
Swift
@MainActor public override func viewDidLoad() -
WKNavigationDelegate method: listens for navigation changes. If the navigation is to the redirect URI (matching
redirectUriHost), call thehandleCallbackand remove the webView from the view.Declaration
Swift
@MainActor public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) -
Undocumented
Declaration
Swift
@MainActor public override func viewDidDisappear(_ animated: Bool)
View on GitHub