Created
June 9, 2018 15:54
-
-
Save movii/d91453b9819f0711b1205ed5249d205a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NativeInvokeJavaScriptBrowserViewController: WKNavigationDelegate { | |
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
switch requestJavaScriptMethod! | |
{ | |
case "SayHelloTo": | |
wkWebView.evaluateJavaScript("sayHelloTo('Lien')") | |
case "SayHelloToWithReply": | |
wkWebView.evaluateJavaScript("sayHelloToWithReply('Lien')") { (any,error) -> Void in | |
print("\(any as! String)") | |
} | |
default: | |
wkWebView.evaluateJavaScript("sayHello()") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment