mirror of
https://github.com/yattee/yattee.git
synced 2025-12-08 00:58:15 +00:00
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
This commit is contained in:
@@ -354,7 +354,8 @@ extension View {
|
|||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func applyControlsBackground(enabled: Bool, cornerRadius: Double) -> some View {
|
func applyControlsBackground(enabled: Bool, cornerRadius: Double) -> some View {
|
||||||
if enabled {
|
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+
|
// Use Liquid Glass on iOS 26+
|
||||||
self.glassEffect(
|
self.glassEffect(
|
||||||
.regular.interactive(),
|
.regular.interactive(),
|
||||||
@@ -363,7 +364,7 @@ extension View {
|
|||||||
} else {
|
} else {
|
||||||
// Fallback to ultraThinMaterial
|
// Fallback to ultraThinMaterial
|
||||||
// swiftlint:disable:next deployment_target
|
// swiftlint:disable:next deployment_target
|
||||||
if #available(iOS 15.0, macOS 12.0, tvOS 15.0, *) {
|
if #available(iOS 15.0, *) {
|
||||||
self
|
self
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: cornerRadius)
|
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 {
|
} else {
|
||||||
self.background(Color.clear)
|
self.background(Color.clear)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user