title: SwiftUI TextField acts disabled in VStack inside ZStack (simulating an Alert with a TextField)
body: <p>I need to make an Alert in <strong>SwiftUI</strong> that has an editable <strong>TextField</strong> in it.  Currently, this isn't supported by SwiftUI (as of <strong>Xcode 11.3</strong>), so I'm looking for a work-around.</p>
  
  <p>I know I can implement by wrapping the normal UIKit bits in a <strong>UIHostingController</strong>, but really want to stick with an all-SwiftUI implementation.</p>
  
  <p>I've got two <strong>VStacks</strong> in a <strong>ZStack</strong>, with the front one (the one with the TextView) being hidden and disabled until until you tap the button.  Take a look at this:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  
  struct ContentView: View {
      @State var isShowingEditField = false
      @State var text: String = "12345"
  
      var body: some View {
          ZStack {
              VStack {
                  Text("Value is \(self.text)")
                  Button(action: {
                      print("button")
                      self.isShowingEditField = true
                  }) {
                      Text("Tap To Test")
                  }
              }
              .disabled(self.isShowingEditField)
              .opacity(self.isShowingEditField ? 0.25 : 1.00)
  
              VStack(alignment: .center) {
                  Text("Edit the text")
                  TextField("", text: self.$text)
                      .multilineTextAlignment(.center)
                      .lineLimit(1)
  
                  Divider()
                  HStack {
                      Button(action: {
                          withAnimation {
                              self.isShowingEditField = false
                              print("completed... value is \(self.text)")
                          }
                      }) {
                          Text("OK")
                      }
                  }
              }
              .padding()
              .background(Color.white)
              .shadow(radius: CGFloat(1.0))
              .disabled(!self.isShowingEditField)
              .opacity(self.isShowingEditField ? 1.0 : 0.0)
          }
      }
  }
  </code></pre>
  
  <p>This seems like it should work to me.  Switching between the two <strong>VStack</strong>s works well, but the <strong>TextField</strong> is not editable.</p>
  
  <p>It acts like it's disabled, but it's not.  Explicitly <strong>.disabled(false)</strong> to the TextField doesn't help.  Also, it should already be enabled anyway since 1) that's the default, 2) the VStack it's in is specifically being set as enabled, and 3) The OK button works normally.</p>
  
  <p>Ideas/workarounds?<br>
  Thanks!</p>