Created
February 23, 2018 10:41
-
-
Save JillevdW/8237b336501a0cd9e9c8827a641a1c00 to your computer and use it in GitHub Desktop.
delegate functions Nederlands
This file contains hidden or 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 ViewController: WKScriptMessageHandler, WKNavigationDelegate { | |
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { | |
//Deze functie verwerkt de berichten vanuit javascript. | |
//We kunnen hier de meegestuurde data vinden in de message body: | |
guard let response = message.body as? String else { return } | |
print(response) | |
} | |
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
//Deze functie zal gebruikt worden wanneer de webview klaar is met het laden van de webpagina. | |
//Dit kunnen we mooi gebruiken om data naar de webview te sturen. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment