The app was crashing from memory pressure on tvOS. Three causes fixed: 1. Feed was rendering all 418 highlights at once — capped to 50 items. 2. FeaturedGameCard had 3 blur effects (radius 80-120) on large circles for team color glow — replaced with a single LinearGradient. Same visual effect, fraction of the GPU memory. 3. BroadcastBackground had 3 blurred circles (radius 120-140, 680-900px) rendering on every screen — replaced with RadialGradients which are composited by the GPU natively without offscreen render passes. Also fixed iOS build: replaced tvOS-only font refs (tvSectionTitle, tvBody) with cross-platform equivalents in DashboardView fallback state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
73 lines
2.1 KiB
Swift
73 lines
2.1 KiB
Swift
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
|
|
}
|
|
}
|