We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1
Swift notes
- Because you use state properties to hold information that’s
specific to a view and its subviews, you always create state as private.
- using the Observable() macro. With Observation, a view in
SwiftUI can support data changes without using property wrappers or bindings. SwiftUI watches for any observable property changes that could affect a view, and displays the correct version of the view after a change.
- Use the @State attribute to initialize a model object the same
way you use it to initialize properties inside a view. Just like SwiftUI initializes state in a view only once during the lifetime of the view, it initializes state in an app only once during the lifetime of the app.
-GeometryReader dynamically reports size and position
information about the parent view and the device, and updates whenever the size changes; for example, when the user rotates their iPhone.