LavaUI docs

struct Bindable

Swift

@propertyWrapper @dynamicMemberLookup struct Bindable<Value> where Value : AnyObject

Projects bindings out of a reference-type model: $model.property.

@State owns view-local storage and cannot be reached from outside the view tree, which is why state shared with a menubar (LavaApp.run(menu:)) has to live in an @Observable class instead. This is what gives that class the same $value ergonomics @State has:

@Bindable var session: TraceLoomSession
…
EditorView(text: $session.rules)
Toggle("Show log", isOn: $session.showLog)

Read session.property directly for a value; use $session.property where a Binding is wanted. Each projection goes through Binding(_:_:) above, so it registers its Observation dependency as it is built.

Only a wrapper, deliberately: it owns no storage and adopts none, so StateTransfer skips it — the model outlives the view struct on its own, which is the entire point of putting it in a class.

Sources/LavaUI/Bindable.swift:62

Constructors

init(wrappedValue: Value)

Not documented.

Sources/LavaUI/Bindable.swift:65

Properties

var projectedValue: Bindable<Value> { get }

Not documented.

Sources/LavaUI/Bindable.swift:69

var wrappedValue: Value

Not documented.

Sources/LavaUI/Bindable.swift:63

Methods

subscript<Subject>(dynamicMember keyPath: ReferenceWritableKeyPath<Value, Subject>) -> Binding<Subject> { get }

Not documented.

Sources/LavaUI/Bindable.swift:71