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
sourcesource
-
URL initializer
Declaration
Swift
init(url: URL)Parameters
urlURL
-
Page source
Declaration
Swift
var source: WKWebSource? -
Page URL - use
sourceinsteadDeclaration
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
animatedWhether 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
keyPathPath observed
objectObject observed
changeChange description
contextOptional context
-
Load from source
Declaration
Swift
func load(source: WKWebSource)Parameters
sourcesource
-
Load from remote URL
Declaration
Swift
func load(remote: URL)Parameters
remoteURL
-
Load from file
Declaration
Swift
func load(file: URL, access: URL)Parameters
fileFile
accessRead access
-
Load from string
Declaration
Swift
func load(string: String, base: URL? = nil)Parameters
stringPage to load
baseBase 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
webViewHost view
navigationNavigation type
-
Finish navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didFinish navigation: WKNavigation!)Parameters
webViewHost view
navigationNavigation type
-
Fail provisional navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error)Parameters
webViewHost view
navigationNavigation type
errorError
-
Fail navigation
Declaration
Swift
func webView(_ webView: WKWebView, // swiftlint:disable:next implicitly_unwrapped_optional didFail navigation: WKNavigation!, withError error: Error)Parameters
webViewHost view
navigationNavigation type
errorError
-
Handle challenge
Declaration
Swift
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)Parameters
webViewHost view
challengeChallenge
completionHandlerHandler
-
Decide navigation policy
Declaration
Swift
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)Parameters
webViewHost view
navigationActionAction
decisionHandlerHandler
View on GitHub
WKWebViewController Class Reference