2019-08-21a few seconds read (About 64 words)How to handle link clicked in WKWebView in iOSIssue #365 12345678910111213141516171819202122232425import WebKitimport SafariServicesfinal class WebViewHandler: NSObject, WKNavigationDelegate { var show: ((UIViewController) -> Void)? let supportedSchemes = ["http", "https"] func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { defer { decisionHandler(.allow) } guard navigationAction.navigationType == .linkActivated, let url = navigationAction.request.url, let scheme = url.scheme, supportedSchemes.contains(scheme) else { return } let controller = SFSafariViewController(url: url) show?(controller) }}#swiftiOS