From 3ae346fb7b4a903dc1a60c3ae591b02a09cc312c Mon Sep 17 00:00:00 2001 From: Vadim Kuznetsov Date: Tue, 19 Mar 2024 18:36:23 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20Unable=20to=20open=20any=20item=20from?= =?UTF-8?q?=20"Bachelor=E2=80=99s=20Degrees"=20(#344)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [iOS] Unable to open any item from "Bachelor’s Degrees" section in Discover tab #343 --- Core/Core/View/Base/Webview/WebView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) }