Swift 3检查WebView上的当前URL

Swift 3检查WebView上的当前URL,swift,parsing,url,web,swift3,Swift,Parsing,Url,Web,Swift3,我有我的webView登录页面,上面有很多链接,但我只需要“登录”链接就可以点击 如何使用以下方法检查当前URL字符串 func webView(_ webView: UIWebView,shouldStartLoadWith request: URLRequest,navigationType: UIWebViewNavigationType) -> Bool{ print("Url has changed") let finish = "**link one**"

我有我的webView登录页面,上面有很多链接,但我只需要“登录”链接就可以点击

如何使用以下方法检查当前URL字符串

 func webView(_ webView: UIWebView,shouldStartLoadWith request: URLRequest,navigationType: UIWebViewNavigationType) -> Bool{

 print("Url has changed")
    let finish = "**link one**"


            if **Current URL* == finish {
                print("Url has changed to main")
                print("**link one**")
                return true

}
    return false


    }

UIWebViewDelegate
添加到控制器和
viewDidLoad
Add
webView.delgate=self
。请注意,
WebView
(macOS)和
UIWebView
(iOS)是具有不同接口的不同类。