我试图将旧代码转换为新
我有以下代码,我无法弄清楚如何转换为新类,它给了我错误
“ NavigationType”不是“ WKWebView”的成员类型
//this function must be replaced
extension MessagesListViewController: UIWebViewDelegate {
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool {
if let url = request.url {
if url.absoluteString.contains(".mp4") || url.absoluteString.contains(".png")
{
if self.delegate != nil {
self.delegate?.userDidTapLink(urlRequest: request)
}
return false
}
}
return true
}
}
其他功能
//this function must be replaced
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool {
if (request.url != nil && request.url!.absoluteString.contains("cancelAndReturn=true")) {
self.navigationController?.popViewController(animated: true)
return false
}
if (request.url != nil && request.url!.absoluteString.contains("marry://app")) {
self.navigationController?.popViewController(animated: true)
return false
}
return true
}