Skip to content

WKWebViewController

James Barrow edited this page Jan 29, 2017 · 4 revisions

WKWebViewController

A subclass of BaseWebViewController that wraps a WKWebView in a view controller.

url

The URL of the current page.

Declaration

Swift

public override var url: URL?

---

<br>

### titleOverride
The title to show in the navigation bar if something other than the loaded page’s title is required.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
public override var titleOverride: String?


loading

Returns true if the web view is currently loading, false if not.

Declaration

Swift

public override var loading: Bool

---

<br>

### stopLoading()
Stops the web view from being loaded any more.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
public override func stopLoading()


viewDidLoad()

Declaration

Swift

public override func viewDidLoad()


---

<br>

### deinit


**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
deinit


## KVO Methods

observeValue(forKeyPath:of:change:context:)

Declaration

Swift

public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?)


---


<br>
## Action Methods  <br>

### refreshButtonPressed(_:)
Refrshes the web view when the refresh button is pressed in the toolbar.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
public override func refreshButtonPressed(_ sender: AnyObject?)

Parameters

`sender` The bar button item pressed.


backButtonPressed(_:)

Requests the web view go back a page.

Declaration

Swift

public override func backButtonPressed(_ sender: AnyObject?)


**Parameters**
<table>
<tr><td> `sender` </td><td> The bar button item pressed. </td></tr>
<table>

---

<br>

### forwardButtonPressed(_:)
Requests the web view go forward a page.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
public override func forwardButtonPressed(_ sender: AnyObject?)

Parameters

`sender` The bar button item pressed.


## WKNavigationDelegate Methods

webView(_:decidePolicyFor:decisionHandler:)

Declaration

Swift

@nonobjc public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void)


---


<br>
## Load Methods  <br>

### loadBaseURL()
Creates a URL string, appending http:// if the URL string does not already have it as a prefix and then loads the page in the web view.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
override func loadBaseURL() -> String

Return Value
The base URL string.


Clone this wiki locally