From f033d3f5df80073fa1e80ad2092ecff0b0cb07e6 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 14 Aug 2026 17:11:35 +0200 Subject: [PATCH] =?UTF-8?q?fix(screenshots):=20pin=20the=20shot=20palette?= =?UTF-8?q?=20=E2=80=94=20a=20reused=20device's=20saved=20choice=20shipped?= =?UTF-8?q?=20a=20sunset=20Apple=20TV=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The aurora screens read the LIVE uiPalette default, and shot mode never forced one: the Apple TV Simulator had a sunset palette persisted from manual use, so every tvOS capture came out pink-on-pale while the iPhone set stayed violet. ScreenshotHostView now pins the palette (violet, or PUNKTFUNK_SHOT_PALETTE) before the scene mounts. Also documents the local tvOS-SIMULATOR wall in screenshots.sh: Xcode 26.6 and the 27 beta plan the macro targets swiftui-navigation-transitions pulls in for the tvOS triple and never schedule their swift-syntax deps ('unable to resolve module dependency') — prebuilts on or off. Only the tvOS target links that package, which is why iOS and device builds never hit it. Local workaround, since HomeView's use is canImport-guarded: temporarily unlink the product from the tvOS target, capture, restore. --- .../PunktfunkClient/Screenshots/ScreenshotHost.swift | 12 ++++++++++++ clients/apple/tools/screenshots.sh | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/clients/apple/Sources/PunktfunkClient/Screenshots/ScreenshotHost.swift b/clients/apple/Sources/PunktfunkClient/Screenshots/ScreenshotHost.swift index 92819bfb..3297ed0c 100644 --- a/clients/apple/Sources/PunktfunkClient/Screenshots/ScreenshotHost.swift +++ b/clients/apple/Sources/PunktfunkClient/Screenshots/ScreenshotHost.swift @@ -16,6 +16,7 @@ // can wait for layout instead of guessing with a fixed sleep. #if DEBUG +import PunktfunkKit import SwiftUI #if os(macOS) import AppKit @@ -43,6 +44,17 @@ enum ScreenshotMode { /// readiness ping for the capture script. struct ScreenshotHostView: View { let scene: ShotScene + + init(scene: ShotScene) { + self.scene = scene + // Pin the palette for the capture. The aurora screens read the LIVE `uiPalette` default, + // and a reused Simulator (or a dev Mac) carries whatever was last picked there — the + // Apple TV set once shipped out on a sunset palette that a test device had persisted. + // Idempotent, and only ever runs in shot mode (this view exists behind that gate). + UserDefaults.standard.set( + ProcessInfo.processInfo.environment["PUNKTFUNK_SHOT_PALETTE"] ?? "violet", + forKey: DefaultsKey.uiPalette) + } #if os(iOS) @Environment(\.horizontalSizeClass) private var hSizeClass @Environment(\.verticalSizeClass) private var vSizeClass diff --git a/clients/apple/tools/screenshots.sh b/clients/apple/tools/screenshots.sh index c6602e97..abecf2e6 100755 --- a/clients/apple/tools/screenshots.sh +++ b/clients/apple/tools/screenshots.sh @@ -142,6 +142,14 @@ shoot_sim() { # incremental build instead of cold-building into a throwaway tmpdir — CI pins this # (apple.yml); local runs keep the self-cleaning mktemp default. local dd; dd="${PF_SHOT_DERIVED_DATA:-$(mktemp -d)}"; mkdir -p "$dd" + # tvOS-SIMULATOR trap (Xcode 26.6 and the 27 beta, local only so far): the build planner + # schedules the SwiftPM MACRO plugin targets that swiftui-navigation-transitions pulls in + # (OnceMacro/SwizzlingMacro/AssociationMacro) for the *tvOS* triple and never plans their + # swift-syntax dependencies at all — "unable to resolve module dependency: 'SwiftSyntax'". + # Device archives and iOS builds don't hit it (only the tvOS target links that package), and + # prebuilt-vs-source swift-syntax makes no difference. Until Xcode fixes the planner, the + # workaround is temporarily unlinking SwiftUINavigationTransitions from the tvOS target + # (HomeView's use is canImport-guarded — the push transition degrades to the crossfade). xcodebuild -project Punktfunk.xcodeproj -scheme "$scheme" -configuration Debug \ -sdk "$sdk" -destination "id=$udid" -derivedDataPath "$dd" \ CODE_SIGNING_ALLOWED=NO build >/dev/null \