How does the lifecycle of a SwiftUI View work, regarding storage?
I understand the implications of using @State
, @StateObject
, @ObservedObject
, @Binding
and even a simple let/var
but not how the storage lifecycle works and how it is associated to the above variables
What gives a View it's identity and how does the system knows, when new View instances must be created and when they are only reassigned to this particular created View struct
I found this to be the key to understanding, whats actually going on
CodePudding user response:
That's a pretty big subject, and not one that easily fits into a StackOverflow post.
I think a lot of your questions come up in the Data Essentials in SwiftUI session from WWDC 2020. It goes into some of the internals of how SwiftUI works that will go a long way to helping your understanding.