Last updated 5 months ago
Was this helpful?
โฉ โฉ โฉ binding
A binding connects a to a stored elsewhere.
Add to create a two-way connection between a that stores data, and a that displays and changes the data.
struct ContainerView: View { // โญ๏ธ container's view state (source of truth) @State var isOn = false var body: some View { VStack { // โญ๏ธ ๅจ subview (Toggle) ไธญไฝฟ็จ binding ($isOn) Toggle("Press Me", isOn: $isOn) } } }