Fix plist copyright; move macOS Save/Load to the menu bar

- Info.plists: "Realized Sound" -> "realizedsound" in the copyright string
  (all four demo apps).
- macOS: Save/Load now live in a File menu (Save Rig… ⌘S, Load Rig… ⌘O)
  and a Board menu (Add Board ⌘B, Start ⌘R, Stop ⌘.) in the app shell's
  AppDelegate; the in-view Save…/Load… buttons and their NSPanel code are
  now iOS-only (#if !os(macOS)), with iOS keeping fileExporter/Importer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 09:39:06 -07:00
parent 6c1859c59d
commit 8ffc1caa42
6 changed files with 116 additions and 30 deletions
@@ -60,10 +60,12 @@ public struct ShoeGazeBuilderView: View {
/// Bumped on transport/edit actions to force a re-read of `engine.isRunning`.
@State private var transportTick: Bool = false
/// iOS file-dialog presentation flags + the document to export.
#if !os(macOS)
/// iOS file-dialog presentation flags + the document to export. (macOS uses the File menu.)
@State private var showImporter: Bool = false
@State private var showExporter: Bool = false
@State private var exportDocument: RigFileDocument = RigFileDocument(data: Data())
#endif
// MARK: - Init
@@ -176,10 +178,14 @@ public struct ShoeGazeBuilderView: View {
Spacer()
// On macOS, Save/Load live in the app's File menu (see the app shell's AppDelegate);
// on iOS they stay in-view, driven by fileExporter/fileImporter.
#if !os(macOS)
Button("Save…") { saveAction() }
.buttonStyle(.bordered).tint(.blue)
Button("Load…") { loadAction() }
.buttonStyle(.bordered).tint(.blue)
#endif
}
}
@@ -290,42 +296,23 @@ public struct ShoeGazeBuilderView: View {
transportTick.toggle()
}
// MARK: - Save / Load
// MARK: - Save / Load (iOS)
// On macOS, Save/Load are driven from the app's File menu (the app shell owns the
// NSSavePanel/NSOpenPanel and calls `shoeGaze.saveRig`/`loadRig` directly). On iOS they are
// in-view, presenting `fileExporter`/`fileImporter`.
#if !os(macOS)
private func saveAction() {
#if os(macOS)
let panel: NSSavePanel = NSSavePanel()
panel.allowedContentTypes = [.json]
panel.nameFieldStringValue = "\(ShoeGazeBuilderView.defaultRigFileName).json"
panel.canCreateDirectories = true
panel.begin { response in
guard response == .OK, let url: URL = panel.url else { return }
do { try shoeGaze.saveRig(to: url) }
catch { print("[ShoeGazeBuilderView] saveRig failed: \(error)") }
}
#else
do {
exportDocument = RigFileDocument(data: try shoeGaze.rigData())
showExporter = true
} catch {
print("[ShoeGazeBuilderView] rigData failed: \(error)")
}
#endif
}
private func loadAction() {
#if os(macOS)
let panel: NSOpenPanel = NSOpenPanel()
panel.allowedContentTypes = [.json]
panel.canChooseDirectories = false
panel.allowsMultipleSelection = false
panel.begin { response in
guard response == .OK, let url: URL = panel.url else { return }
loadRig(from: url)
}
#else
showImporter = true
#endif
}
/// Loads a rig from a URL, stopping/restarting the engine around the rebuild and resetting the
@@ -343,7 +330,6 @@ public struct ShoeGazeBuilderView: View {
transportTick.toggle()
}
#if !os(macOS)
private func handleImport(_ result: Result<URL, Error>) {
switch result {
case .success(let url):