Use the error.code value of the error generated by didFailProvisionalNavigation , and add the 'handler' code there:
func webView(webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: NSError) {
if error.code == -1001 {
} else if error.code == -1003 {
} else if error.code == -1100 {
}
}
source
share