diff --git a/.gitignore b/.gitignore index 551a3f5..dfaea8b 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,5 @@ Derived/ ### Tuist managed dependencies ### Tuist/Dependencies + +.mise.toml diff --git a/iBox/Sources/Web/WebView.swift b/iBox/Sources/Web/WebView.swift index 298a1d7..760425d 100644 --- a/iBox/Sources/Web/WebView.swift +++ b/iBox/Sources/Web/WebView.swift @@ -71,6 +71,7 @@ class WebView: UIView { private func setupProperty() { backgroundColor = .backgroundColor webView.navigationDelegate = self + webView.uiDelegate = self progressObserver = webView.observe(\.estimatedProgress, options: .new) { [weak self] webView, _ in self?.progressView.setProgress(Float(webView.estimatedProgress), animated: true) } @@ -221,3 +222,12 @@ extension WebView: UIGestureRecognizerDelegate { } } + +extension WebView: WKUIDelegate { + func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { + if navigationAction.targetFrame == nil { + webView.load(navigationAction.request) + } + return nil + } +}