Files
MLBApp/mlbTVOS/Views/Components/PlatformUI.swift
Trey t fda809fd2f Add iOS/iPad target with platform-adaptive UI
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 21:30:28 -05:00

40 lines
934 B
Swift

import SwiftUI
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)
}
}
extension View {
@ViewBuilder
func platformCardStyle() -> some View {
#if os(tvOS)
self.buttonStyle(.card)
#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
}
}