SwiftUI View (apparently) laid out before init runs
问题 TL;DR It seems that the ContentView below evaluates the body's if statement before init has run. Is there a race condition, or is my mental model out-of-order? Kudos A shout-out to Asperi, who provided the state-initializer equivalent that solves today's problem. Code Why does ContentView display "dummy is nil"? It seems something gets closed over before the initializer sets dummy . What is it about the second assignment that fixes things? class Dummy { } struct ContentView: View { @State