Post

Replies

Boosts

Views

Activity

How to gain access to the UIView of a UIViewRepresentable
What would be an idiomatic means of causing a WKWebView to be reloaded via a method of a UIViewRepresentable struct? Here's my struct: struct WebView: UIViewRepresentable { var url: URL func makeUIView(context: Context) -> WKWebView { let webView = WKWebView() let request = URLRequest(url: url) webView.load(request) return webView } func reload() { // I'd like to get hold of the webView UIView here and call its `reload()`. } func updateUIView(_ webView: WKWebView, context: Context) { } }
1
0
468
Apr ’24