Understanding SwiftUI view lifecycles
['Ole Begemann']
Ole Begemann
When a state change causes a change in a view’s value, SwiftUI will find the corresponding view object in the render tree and update it in place, rather than recreating a new view object from scratch. Importantly, the lifetime extends to view state defined with @State and @StateObject : when a view gets removed from the render tree, its state is lost; when the view gets inserted again later, the state will be recreated with its initial value. @State = when the view’s state was created (equivalent to the start of the view’s lifetime)