DQWebKit
使用 WKWebView 实现混合,过滤重定向,锚点跳转,重复打开等,使用推送打开新页面
CocoaPods
pod "DQWebKit"
##使用
import UIKit
import DQWebKit
class ViewController: UIViewController,DQWebViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func goWeb(_ sender: Any) {
let webCtrl = DQWebViewController()
// webCtrl.urlString = "http://m.liji.shop/APP_H5.html"//交互
webCtrl.urlString = "https://github.com/dushengjia/DQWebKit/tree/master"//普通网页
webCtrl.delegate = self
self.navigationController?.pushViewController(webCtrl, animated: true)
}
//Mark: DQWebViewControllerDelegate
func invoke(apiName: String, paramDic: Dictionary<String, Any>, webView: DQWebView, completion: @escaping (String?) -> Void) {
debugPrint("000---apiName==\(apiName)---paramDic==\(paramDic)-")
completion("")//有回调给 web 的内容从这里 给 web 没有也要给个空字符串不然会奔溃
}
}