WKWebViewController
class WKWebViewController : UIViewController
extension WKWebViewController: WKUIDelegate
extension WKWebViewController: WKNavigationDelegate
Provides WKWebView hosting support
-
Default initializer
Declaration
Swift
init()
-
Source initializer
Declaration
Swift
init(source: WKWebSource?)
Parameters
source
source
-
URL initializer
Declaration
Swift
init(url: URL)
Parameters
url
URL
-
Page source
Declaration
Swift
var source: WKWebSource?
-
Page URL - use
source
insteadDeclaration
Swift
var url: URL?
-
Tint Color
Declaration
Swift
var tintColor: UIColor?
-
Allows local URLs
Declaration
Swift
var allowsFileURL: Bool
-
Delegate
Declaration
Swift
weak var delegate: WKWebViewControllerDelegate?
-
Bypassed SSL Hosts
Declaration
Swift
var bypassedSSLHosts: [String]
-
Cookies
Declaration
Swift
var cookies: [HTTPCookie]
-
Headers
Declaration
Swift
var headers: [String : String]
-
Custom User Agent
Declaration
Swift
var customUserAgent: String? { get set }
-
User Agent
Declaration
Swift
var userAgent: String? { get set }
-
Pure User Agent
Declaration
Swift
var pureUserAgent: String? { get set }
-
Show title in navigation bar
Declaration
Swift
var websiteTitleInNavigationBar: Bool
-
Done button position
Declaration
Swift
var doneBarButtonItemPosition: NavigationBarPosition
-
Left nav bar items
Declaration
Swift
var leftNavigationBarItemTypes: [BarButtonItemType]
-
Right nav bar items
Declaration
Swift
var rightNavigationBarItemTypes: [BarButtonItemType]
-
Toolbar items
Declaration
Swift
var toolbarItemTypes: [BarButtonItemType]
-
Back button image
Declaration
Swift
var backBarButtonItemImage: UIImage?
-
Forward button image
Declaration
Swift
var forwardBarButtonItemImage: UIImage?
-
Reload button image
Declaration
Swift
var reloadBarButtonItemImage: UIImage?
-
Stop button image
Declaration
Swift
var stopBarButtonItemImage: UIImage?
-
Activity button image
Declaration
Swift
var activityBarButtonItemImage: UIImage?
-
Prepare for hide
Declaration
Swift
override func viewWillDisappear(_ animated: Bool)
Parameters
animated
Whether animating
-
KVO observation
Declaration
Swift
override func observeValue(forKeyPath keyPath: String?, // swiftlint:disable:previous block_based_kvo of object: Any?, // swiftlint:disable:next discouraged_optional_collection change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?)
Parameters
keyPath
Path observed
object
Object observed
change
Change description
context
Optional context
-
Load from source
Declaration
Swift
func load(source: WKWebSource)
Parameters
source
source
-
Load from remote URL
Declaration
Swift
func load(remote: URL)
Parameters
remote
URL
-
Load from file
Declaration
Swift
func load(file: URL, access: URL)
Parameters
file
File
access
Read access
-
Load from string
Declaration
Swift
func load(string: String, base: URL? = nil)
Parameters
string
Page to load
base
Base URL
-
Go back to first page
Declaration
Swift
func goBackToFirstPage()
-
Start navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didStartProvisionalNavigation navigation: WKNavigation!)
Parameters
webView
Host view
navigation
Navigation type
-
Finish navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didFinish navigation: WKNavigation!)
Parameters
webView
Host view
navigation
Navigation type
-
Fail provisional navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error)
Parameters
webView
Host view
navigation
Navigation type
error
Error
-
Fail navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didFail navigation: WKNavigation!, withError error: Error)
Parameters
webView
Host view
navigation
Navigation type
error
Error
-
Handle challenge
Declaration
Swift
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
Parameters
webView
Host view
challenge
Challenge
completionHandler
Handler
-
Decide navigation policy
Declaration
Swift
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
Parameters
webView
Host view
navigationAction
Action
decisionHandler
Handler