diff --git a/Core/Core/View/Base/Webview/WebView.swift b/Core/Core/View/Base/Webview/WebView.swift index 54fa11796..df174b904 100644 --- a/Core/Core/View/Base/Webview/WebView.swift +++ b/Core/Core/View/Base/Webview/WebView.swift @@ -53,6 +53,7 @@ public struct WebView: UIViewRepresentable { public class Coordinator: NSObject, WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler { var parent: WebView + var url: URL? init(_ parent: WebView) { self.parent = parent @@ -252,16 +253,18 @@ public struct WebView: UIViewRepresentable { } webView.customUserAgent = userAgent + context.coordinator.url = nil return webView } public func updateUIView(_ webview: WKWebView, context: UIViewRepresentableContext) { if let url = URL(string: viewModel.url) { - if webview.url?.absoluteString != url.absoluteString { + if context.coordinator.url?.absoluteString != url.absoluteString { DispatchQueue.main.async { isLoading = true } + context.coordinator.url = url let request = URLRequest(url: url) webview.load(request) }