SwiftUI Bindings

These are notes I’ve taken while watching the video of the corresponding session. They don’t have all the information contained in the video, but I’ve tried to still write the main points for my personal use cases.

You can use $ to bind values to SwiftUI views

Text($value)

Whenever $value changes Text is automatically updated by SwiftUI

Otherwise you can use the@ObjectBinding modifier. By applying it to the model it tells SwiftUI that the model is the source of truth for the view. SwiftUIwill keep the view in sync with themodel.

Image

Valentino Urbano

iOS Developer, Swift, Writer, Husband

Back to Overview