title: SwiftUI .onAppear, only running once
body: <p>In a <code>SwiftUI</code> app I have code like this:</p>
  <pre><code>var body: some View {
      VStack {
          Spacer()
          ........
      }
      .onAppear {
        .... I want to have some code here ....
        .... to run when the view appears ....
      }
  }
  </code></pre>
  <p>My problem is that I would like to run some code inside the <em>.onAppear</em> block, so that it gets run when the app appears on screen, after launching or after being in the background for a while. But it seems like this code is only run once at app launch, and never after. Am I missing something? Or should I use a different strategy to get the result I want?</p>