From bec29668a00ecc13df84b947554ae04a08af5ac4 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 10 Nov 2025 12:47:11 +0100 Subject: [PATCH] Fix glassEffect API availability for macOS and tvOS - Make glassEffect iOS-only as it's not available on other platforms - Use ultraThinMaterial fallback for macOS and tvOS - Fixes build error in GitHub Actions with Xcode 16.4 --- Shared/Views/ControlsBar.swift | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Shared/Views/ControlsBar.swift b/Shared/Views/ControlsBar.swift index 7eb6aa63..ed78e63c 100644 --- a/Shared/Views/ControlsBar.swift +++ b/Shared/Views/ControlsBar.swift @@ -354,7 +354,8 @@ extension View { @ViewBuilder func applyControlsBackground(enabled: Bool, cornerRadius: Double) -> some View { if enabled { - if #available(iOS 26.0, macOS 26.0, tvOS 26.0, *) { + #if os(iOS) + if #available(iOS 26.0, *) { // Use Liquid Glass on iOS 26+ self.glassEffect( .regular.interactive(), @@ -363,7 +364,7 @@ extension View { } else { // Fallback to ultraThinMaterial // swiftlint:disable:next deployment_target - if #available(iOS 15.0, macOS 12.0, tvOS 15.0, *) { + if #available(iOS 15.0, *) { self .background( RoundedRectangle(cornerRadius: cornerRadius) @@ -385,6 +386,31 @@ extension View { ) } } + #else + // Fallback to ultraThinMaterial for macOS and tvOS + // swiftlint:disable:next deployment_target + if #available(macOS 12.0, tvOS 15.0, *) { + self + .background( + RoundedRectangle(cornerRadius: cornerRadius) + .fill(.ultraThinMaterial) + ) + .overlay( + RoundedRectangle(cornerRadius: cornerRadius) + .stroke(Color("ControlsBorderColor"), lineWidth: 0.5) + ) + } else { + self + .background( + RoundedRectangle(cornerRadius: cornerRadius) + .fill(Color.gray.opacity(0.3)) + ) + .overlay( + RoundedRectangle(cornerRadius: cornerRadius) + .stroke(Color("ControlsBorderColor"), lineWidth: 0.5) + ) + } + #endif } else { self.background(Color.clear) }