title: how to communicate between WKWebView in swiftUI with javascript in HTML5
body: <p>I use WKWebView within swift UI， may I please ask how I can communicate between Javascript in Html5 and WebKit? I use userContentController, and also called userContentController.add(message handler, name: &quot;message handler&quot;), but I couldn't find the WebKit property in the window property in the Html5， it is undefined. I don't know how to adjust my code, and how to call the website to communicate with the WebKit to WKWebkit in Javascript, below is my code</p>
  <pre><code> func updateUIView(_ uiView:WKWebView,context:Context) {
          if let url = url, let requestURL=URL(string:url){
              let webConfiguration=WKWebViewConfiguration()
              let userContentController=WKUserContentController()
              webConfiguration.userContentController=userContentController
              
              uiView.load(URLRequest(url:requestURL))
              var cache=URLCache.init()
              URLCache.shared.removeAllCachedResponses()
              URLCache.shared.diskCapacity=0
              URLCache.shared.memoryCapacity=0;            
              userContentController.add(messageHandler, name: &quot;messageHandler&quot;)
  
          }
          
      }
  </code></pre>