Files
openless/Sources/OpenLessUI/GlassBackground.swift
T

19 lines
513 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import SwiftUI
/// macOS 26+ 用真 Liquid Glass(.glassEffect),macOS 15 fallback 到 .ultraThinMaterial。
struct GlassBackground: ViewModifier {
func body(content: Content) -> some View {
if #available(macOS 26.0, *) {
content.glassEffect(.regular.interactive(), in: Capsule())
} else {
content.background(.ultraThinMaterial, in: Capsule())
}
}
}
extension View {
func openLessGlass() -> some View {
modifier(GlassBackground())
}
}