Third lesson, hot topics πŸ“šπŸ”₯

Link to Spotz
Each chapter gets added as a git branch then merged to main.

Handling User Input juggles a few hot topics. @State, @Environment, @Binding & @Observable.
When I finished the tutorial I had no grasp on any of it. Turned to the documentation for some clarity.
Trying to read with my sons play fighting & pushing back against morning drowsiness had me circling back & rechecking but when I got to Binding it started to click- use this property wrapper to get read & write the source of truth and update the whole view. State property wrapper could update the whole view but it is read only. I hope I am understanding this correctly πŸ˜… Environment passes a value into the view. Observable is a macro that makes the object conform to the ‘Observable’ protocol. This allows SwiftUI to see when the object being observed has a change made, and SwiftUI can update the view.

Standard

Leave a comment