WebViewControllerProtocol
@MainActor
public protocol WebViewControllerProtocol : ViewControllerProtocol, WebViewDelegate
网页视图控制器协议,可覆写
WebViewControllerProtocol默认未开启WebView重用,如需开启,方式如下:
- 只需配置WebView.reuseConfigurationBlock并设置ViewControllerManager.webViewReuseIdentifier不为nil即可
- 其他初始化、预加载、回收等重用操作框架会自动处理,详见源码
- 如果需要预缓存资源,配置WebView.reusePreloadUrlBlock后再设置webViewReuseIdentifier即可
-
网页视图,默认显示滚动条,启用前进后退手势
Declaration
Swift
@MainActor var webView: WebView { get }
-
网页请求,设置后会自动加载,支持NSString|NSURL|NSURLRequest。默认nil
Declaration
Swift
@MainActor var webRequest: Any? { get set }
-
渲染网页配置,setupWebView之前调用,默认空实现
Declaration
Swift
@MainActor func setupWebConfiguration(_ configuration: WKWebViewConfiguration)
-
渲染网页视图,setupSubviews之前调用,默认空实现
Declaration
Swift
@MainActor func setupWebView()
-
渲染网页视图布局,setupSubviews之前调用,默认铺满
Declaration
Swift
@MainActor func setupWebLayout()
-
渲染网页桥接,jsBridgeEnabled启用后生效,setupSubviews之前调用,默认空实现
Declaration
Swift
@MainActor func setupWebBridge(_ bridge: WebViewJSBridge)
-
webView
Default implementationDefault Implementation
网页视图,默认显示滚动条,启用前进后退手势
Declaration
Swift
@MainActor public var webView: WebView { get }
-
webRequest
Default implementationDefault Implementation
网页请求,设置后会自动加载,支持NSString|NSURL|NSURLRequest。默认nil
Declaration
Swift
@MainActor public var webRequest: Any? { get set }
-
setupWebConfiguration(_:
Default implementation) Default Implementation
渲染网页配置,setupWebView之前调用,默认空实现
Declaration
Swift
@MainActor public func setupWebConfiguration(_ configuration: WKWebViewConfiguration)
-
setupWebView()
Default implementationDefault Implementation
渲染网页视图,setupSubviews之前调用,默认空实现
Declaration
Swift
@MainActor public func setupWebView()
-
setupWebLayout()
Default implementationDefault Implementation
渲染网页视图布局,setupSubviews之前调用,默认铺满
Declaration
Swift
@MainActor public func setupWebLayout()
-
setupWebBridge(_:
Default implementation) Default Implementation
渲染网页桥接,setupSubviews之前调用,默认空实现
Declaration
Swift
@MainActor public func setupWebBridge(_ bridge: WebViewJSBridge)