Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
The onboarding view needs no SwiftPM resource and keeps the demo's disk figures in the mock
v0lumehi26b2cd0b2588
diff --git a/frontend/Onboarding.md b/frontend/Onboarding.mdindex b8541960..59c3f0cf 100644--- a/frontend/Onboarding.md+++ b/frontend/Onboarding.md@@ -50,7 +50,7 @@ Persist the current step and selections before handling `skipForLater`; inject t## Presentation choices-The flow retains the launcher's dark appearance, palette, Manrope, cream capsule primary button, secondary button style and 1.8:1 cover crop. The app currently forces dark mode, so onboarding does too. The existing app icon is packaged as a SwiftPM resource. Background preparation stays beside Xcode, while a fixed footer keeps the primary action visible at the launcher's 900 × 680 minimum window size. Long content scrolls.+The flow retains the launcher's dark appearance, palette, Manrope, cream capsule primary button, secondary button style and 1.8:1 cover crop. The app currently forces dark mode, so onboarding does too. The welcome icon is the app's own (`NSApp.applicationIconImage` inside the .app, a symbol under `swift run`); there is no SwiftPM resource, because the release workflow copies only the executable. Background preparation stays beside Xcode, while a fixed footer keeps the primary action visible at the launcher's 900 × 680 minimum window size. Long content scrolls.Return activates the primary action, Escape and controller B go back. Every interactive element has an onboarding controller target. Step headings receive VoiceOver focus, and changing status is announced. Reduced Motion replaces slides with fades, shows completed checks immediately, stops indeterminate loops and disables progress interpolation.@@ -64,4 +64,4 @@ NX_ONBOARDING_CAPTURE_DIR="$PWD/.build/onboarding-captures" swift test --filterThe last command optionally captures all six screens at minimum window size in English and Simplified Chinese. It only hosts mock SwiftUI views. The normal suite skips that capture unless requested.-Files added: `OnboardingState.swift`, `MockOnboardingDriver.swift`, `OnboardingView.swift`, `Resources/OnboardingIcon.png`, `OnboardingTests.swift`, and this note. Files changed: `NSPortBuilderApp.swift` (demo branch), `Localization.swift` (both languages), and `Package.swift` (icon resource).+Files added: `OnboardingState.swift`, `MockOnboardingDriver.swift`, `OnboardingView.swift`, `OnboardingTests.swift`, and this note. Files changed: `NSPortBuilderApp.swift` (demo branch) and `Localization.swift` (both languages).diff --git a/frontend/Package.swift b/frontend/Package.swiftindex d5c9fd97..2eed0a5b 100644--- a/frontend/Package.swift+++ b/frontend/Package.swift@@ -5,7 +5,7 @@ let package = Package(name: "NSPortBuilder",platforms: [.macOS(.v13)],targets: [- .executableTarget(name: "NSPortBuilder", path: "Sources/NSPortBuilder", resources: [.process("Resources")]),+ .executableTarget(name: "NSPortBuilder", path: "Sources/NSPortBuilder"),.testTarget(name: "NSPortBuilderTests", dependencies: ["NSPortBuilder"])])diff --git a/frontend/Sources/NSPortBuilder/MockOnboardingDriver.swift b/frontend/Sources/NSPortBuilder/MockOnboardingDriver.swiftindex 8a257d62..dcb20c6f 100644--- a/frontend/Sources/NSPortBuilder/MockOnboardingDriver.swift+++ b/frontend/Sources/NSPortBuilder/MockOnboardingDriver.swift@@ -13,7 +13,12 @@ import Foundationprivate var retriedKeys = false/// A stored snapshot is injected; persistence belongs to the real driver. `animated: false` is for state tests.- init(scenario: Scenario = .fresh, state: OnboardingState = .init(), lang: Lang = .initial(), animated: Bool = true) {+ /// The demo's invented disk figures live here only; a real driver measures the volume.+ nonisolated static var sampleState: OnboardingState {+ var s = OnboardingState(); s.welcome = .requirements(freeGB: 64, neededGB: 24); return s+ }++ init(scenario: Scenario = .fresh, state: OnboardingState = MockOnboardingDriver.sampleState, lang: Lang = .initial(), animated: Bool = true) {self.scenario = scenario; self.state = state; self.lang = lang; self.animated = animatedif animated { enterStep() }}diff --git a/frontend/Sources/NSPortBuilder/OnboardingState.swift b/frontend/Sources/NSPortBuilder/OnboardingState.swiftindex d464d840..0db84f86 100644--- a/frontend/Sources/NSPortBuilder/OnboardingState.swift+++ b/frontend/Sources/NSPortBuilder/OnboardingState.swift@@ -91,7 +91,7 @@ struct OnboardingState: Equatable {enum Primary: Equatable { case start, next, getXcode, finishXcodeSetup, retry, confirmKeys, openLibrary, waiting }var step: OnboardingStep = .welcome- var welcome: Welcome = .requirements(freeGB: 64, neededGB: 24)+ var welcome: Welcome = .requirements(freeGB: 0, neededGB: 0)var platform: Platform = .emptyvar xcode: Xcode = .checkingvar setup: [OnboardingSetupTask: OnboardingTaskState] = [:]diff --git a/frontend/Sources/NSPortBuilder/OnboardingView.swift b/frontend/Sources/NSPortBuilder/OnboardingView.swiftindex 76c5eaf1..9cb58473 100644--- a/frontend/Sources/NSPortBuilder/OnboardingView.swift+++ b/frontend/Sources/NSPortBuilder/OnboardingView.swift@@ -130,10 +130,7 @@ import UniformTypeIdentifiersVStack(alignment: .leading, spacing: 14) {if state.step == .welcome {HStack(spacing: 14) {- if let icon = Bundle.module.image(forResource: "OnboardingIcon") {- Image(nsImage: icon).resizable().scaledToFit().frame(width: 62, height: 62)- .accessibilityHidden(true)- }+ OnboardingAppIcon().frame(width: 62, height: 62).accessibilityHidden(true)Text(t("onboarding.brand")).font(.manrope(27, .bold)).tracking(-0.8)}.padding(.bottom, 14)@@ -579,3 +576,16 @@ private struct OnboardingCheck: View {.background(LauncherWindowChrome()).preferredColorScheme(.dark)}}++/// The app's own icon. A bare `swift run` executable has no icon (macOS shows a generic one), so+/// there a symbol stands in. No SwiftPM resource: the release workflow copies only the executable.+struct OnboardingAppIcon: View {+ var body: some View {+ if Bundle.main.bundlePath.hasSuffix(".app") {+ Image(nsImage: NSApp.applicationIconImage).resizable().scaledToFit()+ } else {+ Image(systemName: "gamecontroller.fill").resizable().scaledToFit().padding(10)+ .foregroundStyle(.secondary)+ }+ }+}diff --git a/frontend/Sources/NSPortBuilder/Resources/OnboardingIcon.png b/frontend/Sources/NSPortBuilder/Resources/OnboardingIcon.pngdeleted file mode 100644index a6fa7499..00000000Binary files a/frontend/Sources/NSPortBuilder/Resources/OnboardingIcon.png and /dev/null differdiff --git a/frontend/Tests/NSPortBuilderTests/OnboardingTests.swift b/frontend/Tests/NSPortBuilderTests/OnboardingTests.swiftindex f03d9289..93927059 100644--- a/frontend/Tests/NSPortBuilderTests/OnboardingTests.swift+++ b/frontend/Tests/NSPortBuilderTests/OnboardingTests.swift@@ -165,7 +165,6 @@ final class OnboardingTests: XCTestCase {let output = URL(fileURLWithPath: directory)try FileManager.default.createDirectory(at: output, withIntermediateDirectories: true)NSApplication.shared.setActivationPolicy(.accessory)- XCTAssertNotNil(Bundle.module.image(forResource: "OnboardingIcon"))for lang: Lang in [.en, .zh] {for step in OnboardingStep.allCases {var s = OnboardingState()