Generic Structure


A manager for a value that provides a way to mutate it.


@frozen @propertyWrapper @dynamicMemberLookup struct Binding<Value>


Use a binding to create a two-way connection between a view and its underlying model. For example, you can create a binding between a Toggle and a Bool property of a State. Interacting with the toggle control changes the value of the Bool, and mutating the value of the Bool causes the toggle to update its presented state.

You can get a binding from a State by accessing its binding property. You can also use the $ prefix operator with any property of a State to create a binding.




Creates a binding by projecting the base value to an optional value.


Attempts to create a binding by projecting the base optional value to its unwrapped value.

Instance Properties

var transaction: Transaction

The transaction used for any changes to the binding’s value.

Instance Methods

func animation(Animation?) -> Binding<Value>

Applies an animation to the bound value when it changes.

func transaction(Transaction) -> Binding<Value>

Applies a transaction to the bound value when it changes.

func update()

Called immediately before the view’s body() function is executed, after updating the values of any link variables stored in self.

Type Methods

static func constant(Value) -> Binding<Value>

Creates a binding with an immutable value.


subscript<Subject>(dynamicMember: WritableKeyPath<Value, Subject>) -> Binding<Subject>

Creates a new Binding focused on Subject using a key path.


Conforms To