Swift 6 · SwiftUI basics

Bind a control to state

A $ prefix passes a two-way binding to a control.

@State private var name = ""

TextField("Name", text: $name)

Official Swift 6 documentation

More swiftui basics commands

All swiftui basics commands · Swift 6 cheatsheet

Was this page helpful?