title: Transition animation not working in SwiftUI
body: <p>I'm trying to create a really simple transition animation that shows/hides a message in the center of the screen by tapping on a button:</p>
  
  <pre><code>struct ContentView: View {
      @State private var showMessage = false
  
      var body: some View {
          ZStack {
              Color.yellow
  
              VStack {
                  Spacer()
                  Button(action: {
                      withAnimation(.easeOut(duration: 3)) {
                          self.showMessage.toggle()
                      }
                  }) {
                      Text("SHOW MESSAGE")
                  }
              }
  
              if showMessage {
                  Text("HELLO WORLD!")
                      .transition(.opacity)
              }
          }
      }
  }
  </code></pre>
  
  <p>According to the documentation of the <code>.transition(.opacity)</code> animation </p>
  
  <blockquote>
    <p>A transition from transparent to opaque on insertion, and from opaque
    to transparent on removal.</p>
  </blockquote>
  
  <p>the message should fade in when the <code>showMessage</code> state property becomes true and fade out when it becomes false. This is not true in my case. The message shows up with a fade animation, but it hides with no animation at all. Any ideas?</p>
  
  <p><strong>EDIT:</strong> See the result in the gif below taken from the simulator.</p>
  
  <p><a href="https://i.stack.imgur.com/toTDr.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/toTDr.gif" alt="enter image description here"></a></p>