Update WKWebView_logging.md
This commit is contained in:
parent
01b66fa9fb
commit
530ab952ac
1 changed files with 1 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ struct WebView: UIViewRepresentable {
|
|||
let source = "function captureLog(msg) { window.webkit.messageHandlers.logHandler.postMessage(msg); } window.console.log = captureLog;"
|
||||
let script = WKUserScript(source: source, injectionTime: .atDocumentEnd, forMainFrameOnly: false)
|
||||
webView.configuration.userContentController.addUserScript(script)
|
||||
// register the bridge script that listens for the output
|
||||
|
||||
webView.configuration.userContentController.add(Controller(), name: "logHandler")
|
||||
|
||||
return webView
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue