title: Is .onAppear causing text to disappear in SwiftUI?
body: <p>I'm making a simple countdown. What I expect to happen is <code>First</code> counts to <code>0</code>, then <code>Second</code> counts to <code>0</code>. When the statement switches to the else block, the HStack text disappears in the canvas. Why could that be happening?</p>
  <pre><code>import SwiftUI
  
  struct TestCountdown: View {
      @State var first = 5
      @State var second = 5
      @State var totalDuration = 30
      var body: some View {
          VStack {
               Text(&quot;\(totalDuration)&quot;)
              if (first &gt; 0) &amp;&amp; (second &gt; 0) {
                  HStack {
                      TestCode(number: $first, title: &quot;First&quot;)
                      Spacer()
                      TestCode(number: $second, title: &quot;Second&quot;)
                  }
              }
          }
          .onAppear {
              Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in
                  if self.totalDuration &gt; 0 {
                      self.totalDuration -= 1
                      
                      if self.first &gt; 0 {
                          self.first -= 1
                      } else {
                          self.second -= 1
                      }
                  }
              }
          }
      }
  }
  
  struct TestCode: View {
      @Binding var number: Int
      @State var title: String
      var body: some View {
          VStack {
              Text(title)
                  .font(.system(size: 20, weight: .medium, design: .rounded))
              Text(&quot;\(number)&quot;)
                  .font(.system(size: 30, weight: .medium, design: .rounded))
          }
          .frame(minWidth: 50, maxWidth: .infinity)
      }
  }
  </code></pre>