RSDWebViewController
open class RSDWebViewController : UIViewController, WKNavigationDelegate
RSDWebViewController is a simple view controller for showing a webview. The base-class implementation
supports loading a web view from a URL, HTML string, or RSDResourceTransformer. It is assumed that
the property will be set for one of these values.
-
The webview attached to this view controller.
Declaration
Swift
@IBOutlet public var webView: WKWebView! -
The loading indicator.
Declaration
Swift
@IBOutlet public var activityIndicator: UIActivityIndicatorView! -
The URL to load into the webview on
viewWillAppear().Declaration
Swift
open var url: URL? -
The HTML string to load into the webview on
viewWillAppear().Declaration
Swift
open var html: String? -
The resource to load into the webview on
viewWillAppear().Declaration
Swift
open var resourceTransformer: RSDResourceTransformer? -
The design system to use for this controller.
Declaration
Swift
open var designSystem: RSDDesignSystem? -
Convenience method for instantiating a web view controller that is the root view controller for a navigation controller.
Declaration
Swift
open class func instantiateController(using designSystem: RSDDesignSystem = RSDDesignSystem(), action: RSDWebViewUIAction? = nil) -> (RSDWebViewController, UINavigationController)
-
Override
viewDidLoad()to instantiate a webview if there wasn’t one created using a storyboard or nib.Declaration
Swift
open override func viewDidLoad() -
Override
viewDidAppear()to load the webview on first appearance.Declaration
Swift
open override func viewDidAppear(_ animated: Bool) -
Set up the desired configuration for the webview. Default implementation activates all data detector types.
Declaration
Swift
open func webViewConfiguration() -> WKWebViewConfiguration -
Failed to load the webview. Default implementation will print the error to the console but is otherwise silent.
Declaration
Swift
open func loadFailed(with error: Error? = nil) -
Dismiss the view controller that was presented modally.
Declaration
Swift
@objc open func close()
-
If the webview request is a clicked link then open using the
UIApplication.open()method.Declaration
Swift
open func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
View on GitHub
RSDWebViewController Class Reference