xgqfrms / wkwebview-jsbridge

WKWebView JsBridge All In One
MIT License
1 stars 0 forks source link

WKWebView & UIWebView #1

Open xgqfrms opened 4 years ago

xgqfrms commented 4 years ago

WKWebView & UIWebView

https://developer.apple.com/documentation/webkit/wkwebview

https://developer.apple.com/documentation/uikit/uiwebview

refs

https://www.cnblogs.com/xgqfrms/p/13883680.html

https://www.cnblogs.com/xgqfrms/p/13881595.html

xgqfrms commented 4 years ago

swift


import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
   var webView: WKWebView!
   override func viewDidLoad() {
      super.viewDidLoad()
      let myURL = URL(string:"https://www.apple.com")
      let myRequest = URLRequest(url: myURL!)
      webView.load(myRequest)
   }
   override func loadView() {
      let webConfiguration = WKWebViewConfiguration()
      webView = WKWebView(frame: .zero, configuration: webConfiguration)
      webView.uiDelegate = self
      view = webView
   }
}