swiftUI用WKWebview如何与JS交互

swiftUI里用WKWebView,如何与H5里的JS交互?我调用了userContentController,也调用了userContentController.add(messageHandler, name: "messageHandler"),但我在H5里面的window找不到webkit,是未定义。我不知道代码应该怎么写,H5应该通过什么方式来调用webkit

 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: "messageHandler")

        }
        
    }

我找到问题了,我没有将confuguration添加到webview里面去