From 396fef876c822bfbe62ecb8063f098ca4be9feed Mon Sep 17 00:00:00 2001 From: Michael Groves Date: Thu, 5 Dec 2024 11:35:09 -0500 Subject: [PATCH] Made changes to the how VisitableView handles its subviews to fix nav & tab bars This is based on https://github.com/hotwired/hotwire-native-ios/pull/37 --- Source/Turbo/Visitable/VisitableView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Turbo/Visitable/VisitableView.swift b/Source/Turbo/Visitable/VisitableView.swift index f0adc36..d8dc553 100644 --- a/Source/Turbo/Visitable/VisitableView.swift +++ b/Source/Turbo/Visitable/VisitableView.swift @@ -24,7 +24,7 @@ open class VisitableView: UIView { open func activateWebView(_ webView: WKWebView, forVisitable visitable: Visitable) { self.webView = webView self.visitable = visitable - addSubview(webView) + insertSubview(webView, belowSubview: activityIndicatorView) addFillConstraints(for: webView) installRefreshControl() showOrHideWebView() @@ -155,7 +155,11 @@ open class VisitableView: UIView { open func showScreenshot() { guard !isShowingScreenshot, !isRefreshing else { return } - addSubview(screenshotContainerView) + if let webView { + insertSubview(screenshotContainerView, aboveSubview: webView) + } else { + addSubview(screenshotContainerView) + } addFillConstraints(for: screenshotContainerView) showOrHideWebView() }