Browser
public class Browser : NSObject, WKNavigationDelegate, WKScriptMessageHandler
The browser used to perform the web scraping.
This class encapsulates the webview and its delegates, providing an closure based API.
-
The webview itself
Declaration
Swift
public private(set) var webView: WKWebView! { get }
-
Tells the delegate that navigation is complete.
Declaration
Swift
public func webView(_: WKWebView, didFinish _: WKNavigation!)
Parameters
webView
The web view that loaded the content.
navigation
The navigation object that finished.
-
Tells the delegate that an error occurred during the early navigation process.
Declaration
Swift
public func webView( _: WKWebView, didFailProvisionalNavigation _: WKNavigation!, withError error: Error )
Parameters
webView
The web view that called the delegate method.
navigation
The navigation object for the operation. This object corresponds to a WKNavigation object that WebKit returned when the load operation began. You use it to track the progress of that operation.
error
The error that occurred.
-
Tells the delegate that an error occurred during navigation.
Declaration
Swift
public func webView(_: WKWebView, didFail _: WKNavigation!, withError error: Error)
Parameters
webView
The web view that reported the error.
navigation
The navigation object for the operation. This object corresponds to a WKNavigation object that WebKit returned when the load operation began. You use it to track the progress of that operation.
error
The error that occurred.
-
Tells the handler that a webpage sent a script message.
Declaration
Swift
public func userContentController( _: WKUserContentController, didReceive message: WKScriptMessage )
Parameters
userContentController
The user content controller that delivered the message to your handler.
message
An object that contains the message details.