v1.6.3 release: notarization-ready macos-ui-xcode template

Scaffolded macOS app now ships audio-input entitlement + mic usage string
under Hardened Runtime (unsandboxed for performance), and compiles under
Swift 6 (NoteController/AppDelegate marked @MainActor).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 08:38:41 -07:00
parent 9ec92277de
commit 5e6534a615
7 changed files with 149 additions and 27 deletions
+16 -10
View File
@@ -49,7 +49,7 @@ Xcode-project templates (ship a real `.xcodeproj` for deliverables SwiftPM can't
| Template | Command | Description |
|---|---|---|
| `macos-ui-xcode` | `lyrebird new MyApp --template macos-ui-xcode` | macOS `.app` (AppKit + SwiftUI), `@UIParam` synth, hardened runtime |
| `macos-ui-xcode` | `lyrebird new MyApp --template macos-ui-xcode` | macOS `.app` (AppKit + SwiftUI), `@UIParam` synth. Notarization-ready: hardened runtime + `.entitlements` (audio-input) + mic usage string, unsandboxed for performance |
| `ios-ui` | `lyrebird new MyApp --template ios-ui` | iOS `.app` (SwiftUI + `iOSAudioDriver`), `AVAudioSession` activation, iPhone + iPad device family |
| `auv3` | `lyrebird new MyPlugin --template auv3` | AUv3 host `.app` + `aumu` `.appex` subclassing `LyrebirdAudioUnit`. Entitlements for both. Subtype + manufacturer pre-filled (manufacturer = `LYRB` placeholder — rewrite for distribution) |
@@ -62,7 +62,7 @@ Each Xcode-project template lays out:
│ └── xcshareddata/xcschemes/<name>.xcscheme
├── <name>.xcworkspace/
│ └── contents.xcworkspacedata (references <name>.xcodeproj)
├── <name>/ (app target sources + Info.plist [+ entitlements for auv3])
├── <name>/ (app target sources + Info.plist [+ .entitlements for macos-ui-xcode / auv3])
│ └── ...
└── <name>Extension/ (auv3 only — extension target + Info.plist + .entitlements)
└── ...
@@ -70,20 +70,26 @@ Each Xcode-project template lays out:
Lyrebird is pulled in via a remote SPM dependency on `https://realizedsound.mooo.com/josh/Lyrebird` (configurable via `ProjectScaffolder.lyrebirdPackageURL`). The scaffolded project lives anywhere on disk and does not need a local checkout.
### Microphone input — not pre-wired in any template
### Distribution & microphone input
No template adds `NSMicrophoneUsageDescription` to the generated `Info.plist`, no template adds the hardened-runtime / sandbox audio-input capability, and the `ios-ui` template's `AVAudioSession` category is `.playback` (output only). Most pieces don't read live input, so the templates default to "no mic capability" rather than triggering a permission prompt on every first run.
The `macos-ui-xcode` template is **notarization-ready and distributable for performance out of the box**. It ships:
- **Hardened Runtime** enabled (required for Developer-ID notarization), and
- `<name>.entitlements` granting `com.apple.security.device.audio-input`, plus `NSMicrophoneUsageDescription` in `Info.plist`.
If a piece needs live input (e.g. tapping the engine input bus into `ScopeCapture` or routing `In.Audio(bus: numOutputChannels)` through the graph), the project owner must add these themselves:
The app is deliberately **not sandboxed** — a live-performance app needs unrestricted audio-device / file / MIDI / OSC access that the App Sandbox would gate. Nothing else is required to move the signed `.app` to another machine and run it: Lyrebird is statically linked (compiled from the SPM source), so there is no external module to bundle. (The bundled-swiftmodule dance in `LyrebirdScratch` is unique to its *runtime* `swiftc` scratchpad and does not apply to a normal Lyrebird app.)
**Engine init** — set `numInputChannels > 0` and pass a non-nil `inputDeviceID` (macOS) when constructing `SynthesisEngine` / starting the driver.
The audio-input entitlement + usage string are **harmless for output-only synths**: no permission prompt fires until the AUHAL input bus actually opens (`numInputChannels > 0`). They exist so a piece that *does* take live input works without the OS hard-killing the Hardened-Runtime process on first input access.
**macOS** (`macos-ui-xcode`, `ui-demo` opened in Xcode, any AppKit/SwiftUI app):
- Add `NSMicrophoneUsageDescription` (string explaining the use) to the target's `Info.plist`. Required since macOS 10.14 — without it the OS silently denies input access and `CoreAudioDriver` reads zeros.
- If the app is sandboxed: add `com.apple.security.device.audio-input` to the `.entitlements` file. The `macos-ui-xcode` template ships unsandboxed; the `auv3` host app is sandboxed and will need the entitlement before the host can read mic in addition to hosting the plugin.
If a piece needs live input (e.g. tapping the engine input bus into `ScopeCapture` or routing `In.Audio(bus: numOutputChannels)` through the graph):
**Engine init** — set `numInputChannels > 0` and pass a non-nil `inputDeviceID` (macOS) when constructing `SynthesisEngine` / starting the driver. On `macos-ui-xcode` the mic entitlement + usage string are already present, so the first `start()` after that triggers the permission prompt directly.
**Other knobs:**
- **Mac App Store** target: add `com.apple.security.app-sandbox` to `<name>.entitlements` plus the specific resource entitlements the piece uses. (Sandboxing is off by default precisely because most performance work is Developer-ID / direct-distribution, not App Store.)
- **Loading a differently-signed dynamic library** (a bundled `.dylib`): add `com.apple.security.cs.disable-library-validation`.
**iOS** (`ios-ui`):
- Add `NSMicrophoneUsageDescription` to the app `Info.plist`.
- Add `NSMicrophoneUsageDescription` to the app `Info.plist` (not pre-wired — the iOS template is output-only by default).
- Change the `AVAudioSession` category in the generated `AppDelegate` / `App` activation block from `.playback` to `.playAndRecord` (typically `mode: .default` or `.measurement`, options `[.defaultToSpeaker, .allowBluetooth]` depending on routing needs). `.playback` is output-only and will return zero-filled input buffers regardless of the engine's `numInputChannels`.
The first `start()` call after these are in place triggers the system permission prompt. Until the user grants, input frames remain zero — a scope tap on input buses will draw a flat line.