import SwiftUI // MARK: - iOS Press Style struct PlatformPressButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .scaleEffect(configuration.isPressed ? 0.98 : 1.0) .opacity(configuration.isPressed ? 0.92 : 1.0) .animation(.easeOut(duration: 0.16), value: configuration.isPressed) } } // MARK: - tvOS Focus Style (Light Theme) #if os(tvOS) struct TVFocusButtonStyle: ButtonStyle { @Environment(\.isFocused) private var isFocused func makeBody(configuration: Configuration) -> some View { configuration.label .scaleEffect(configuration.isPressed ? 0.98 : isFocused ? 1.035 : 1.0) .opacity(configuration.isPressed ? 0.85 : 1.0) .shadow( color: isFocused ? DS.Shadows.cardLifted : .clear, radius: isFocused ? DS.Shadows.cardLiftedRadius : 0, y: isFocused ? DS.Shadows.cardLiftedY : 0 ) .overlay( RoundedRectangle(cornerRadius: 26, style: .continuous) .strokeBorder(DS.Colors.interactive.opacity(isFocused ? 0.72 : 0), lineWidth: 3) ) .overlay { RoundedRectangle(cornerRadius: 26, style: .continuous) .fill(DS.Colors.interactive.opacity(isFocused ? 0.08 : 0)) } .animation(.easeInOut(duration: 0.2), value: isFocused) .animation(.easeOut(duration: 0.12), value: configuration.isPressed) } } #endif // MARK: - Platform Extensions extension View { @ViewBuilder func platformCardStyle() -> some View { #if os(tvOS) self.buttonStyle(TVFocusButtonStyle()) #else self.buttonStyle(PlatformPressButtonStyle()) #endif } @ViewBuilder func platformFocusSection() -> some View { #if os(tvOS) self.focusSection() #else self #endif } @ViewBuilder func platformFocusable(_ enabled: Bool = true) -> some View { #if os(tvOS) self.focusable(enabled) #else self #endif } }