How does a view's lifetime differ from the lifetime of the View struct?
The gist
A View struct is a throwaway description: SwiftUI creates it every time the parent's body is re-evaluated, calls its body and discards it. "The view itself", in terms of lifetime, is a node in the attribute graph tied to an identity (a position in the tree or an explicit id). The node lives from its first insertion into the tree until the identity goes away, and that node is where @State, focus, .task tasks and running animations are stored.
So there are three different "times": the struct's init (frequent, must be cheap and side-effect free), the body call (when dependencies change) and the lifetime of the identity (rarely starts and ends).
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep