From 725444e2e87533a2e4107117eb729feac536debf Mon Sep 17 00:00:00 2001 From: Raul Riera Date: Thu, 21 May 2026 15:47:53 -0400 Subject: [PATCH] fix: iOS 26 toolbar items duplicate in CurrencyInfo loading state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Background's body composed its color via `.background { ... }`, which leaves the content's TupleView exposed at the top of the wrapper. On iOS 26, a parent attaching `.toolbar { ToolbarItem(...) }` then renders each item once per top-level sibling in that TupleView — three Spacer/ LoadingView/Spacer children produced three share buttons inside one Liquid Glass pill. Switching the body to a ZStack encapsulates the children as a single subtree and the bug doesn't fire. Also drops the AnyView storage now that the property is always a Color, and tightens both stored properties to private. --- .../Views/Containers/Background.swift | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/FlipcashUI/Sources/FlipcashUI/Views/Containers/Background.swift b/FlipcashUI/Sources/FlipcashUI/Views/Containers/Background.swift index 89d51a64..406ac387 100644 --- a/FlipcashUI/Sources/FlipcashUI/Views/Containers/Background.swift +++ b/FlipcashUI/Sources/FlipcashUI/Views/Containers/Background.swift @@ -9,23 +9,27 @@ import SwiftUI public struct Background: View where Content: View { - public var background: AnyView - public var content: Content - + private let color: Color + private let content: Content + // MARK: - Init - - + public init(color: Color, @ViewBuilder content: () -> Content) { - self.background = AnyView(color) + self.color = color self.content = content() } // MARK: - Body - + // ZStack (not `.background`) — on iOS 26 the modifier form exposes + // content's TupleView at the top of the wrapper, causing parent + // `.toolbar { ToolbarItem }` items to duplicate per top-level sibling. public var body: some View { - content - .background { - background - .ignoresSafeArea() - } + ZStack { + color + .ignoresSafeArea() + .allowsHitTesting(false) + content + } } }