Files
Lyrebird/docs/migrating-to-2.0.md
T
josh 2c20b02e59 docs: consumer migration guide for Lyrebird 1.x → 2.0
Mirror of the dev-repo docs commit: add docs/migrating-to-2.0.md (module
rename + @UIParam/UIParamNode move into core LyrebirdSynth, with the fix)
and the cross-reference from DEVELOPMENT_AND_RELEASE.md. Docs-only; will be
reconciled by the next full release sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-23 21:21:45 -07:00

85 lines
2.6 KiB
Markdown

<!--
migrating-to-2.0.md
Lyrebird
Copyright (c) 2026 Joshua Parmenter / realizedsound
SPDX-License-Identifier: MIT
-->
# Migrating to Lyrebird 2.0
Lyrebird 2.0 is a major (source-breaking) release. Two changes affect existing
consumers. Both are quick, mechanical fixes.
## 1. Module rename: `Lyrebird` → `LyrebirdSynth`
The core module was renamed. The **product** you add in `Package.swift` is still
`Lyrebird`, but the **module** you import is now `LyrebirdSynth`.
```swift
// Before (1.x)
import Lyrebird
// After (2.0)
import LyrebirdSynth
```
Your `Package.swift` dependency is unchanged:
```swift
.product(name: "Lyrebird", package: "Lyrebird") // still correct
```
## 2. `@UIParam` / `UIParamNode` moved to the core module
In 1.x, the `@UIParam` property wrapper and its projected `UIParamNode` lived in
**`LyrebirdUI`**. In 2.0 they moved into the core **`LyrebirdSynth`** module, so
the parameter model is independent of any UI framework (this is what lets
`LyrebirdUI` be a single cross-platform module — real SwiftUI on Apple,
SwiftOpenUI/GTK4 on Linux).
`LyrebirdUI` does **not** re-export `LyrebirdSynth`, so two things must change in
any code that uses `@UIParam` / `UIParamNode`:
**a. Import `LyrebirdSynth`.** A file that previously got these types via
`import LyrebirdUI` alone now needs:
```swift
import LyrebirdSynth // @UIParam, UIParamNode
import LyrebirdUI // ParameterKnob, ParameterSlider, … (the controls)
```
**b. Depend on the `Lyrebird` product.** Any *target* that touches `@UIParam` /
`UIParamNode` must depend on the `Lyrebird` product, not only `LyrebirdUI` —
otherwise `import LyrebirdSynth` will not resolve its types (Swift's explicit
module maps only expose declared dependencies):
```swift
.target(
name: "MyUI",
dependencies: [
.product(name: "Lyrebird", package: "Lyrebird"), // ← add this
.product(name: "LyrebirdUI", package: "Lyrebird"),
]
)
```
### Symptom
If you miss either, you'll see:
```
error: cannot find type 'UIParamNode' in scope
```
— even in a file that already `import LyrebirdUI`s, and even (for the
missing-target-dependency case) in a file that already `import LyrebirdSynth`s.
Add the import **and** the product dependency and it resolves.
## Not breaking, but new
`LyrebirdUI` is now one cross-platform module. On Apple it compiles against real
SwiftUI exactly as before; on Linux it renders through SwiftOpenUI/GTK4. Apple
consumers need no change for this — the control names (`ParameterKnob`,
`ParameterSlider`, `ParameterXY`, `ParameterButton`, `ParameterLabel`, the scope
/ envelope / status views) and their initializers are unchanged.