title: Why does Text disappear when i click submit?
body: <p>When I type in my EditText view to fill out all the required information and then click submit. Everything I typed disappears. I want this text to remain. I am guessing there is something wrong with my <code>@State</code> objects but cannot figure out what.</p>
  
  <p>SignUpViewModel</p>
  
  <pre><code>class SignUpViewModel : ObservableObject {
  
      @Published
      var error: String? = nil
  
      @Published
      var goHome: Bool = false
  
      @Published
      var goToLogin: Bool = false
  
      func onGoToLoginClicked() {
          self.goToLogin = true
      }
  
      func signUp(firstName: String, lastName: String, email: String, birthday: String, phoneNumber: String, password: String, confirmPassword: String) {
          if (firstName.count &lt; 3) {
              error = "Please enter first name"
              return
          }
          if (lastName.count &lt; 3) {
              error = "Please enter last name"
              return
          }
          if (!email.isEmail()) {
              error = "Pleaes enter valid email"
              return
          }
          if (birthday.isEmpty) {
              error = "Pleae enter valid birthday"
              return
          }
          if (!phoneNumber.isDigits) {
              error = "Please enter valid phone number"
              return
          }
          if (password.count &lt; 8) {
              error = "Please enter a password that is at least 8 characters long"
          }
          if (password != confirmPassword) {
              error = "Password do not match"
          }
          Auth.auth().createUser(withEmail: email, password: password, completion: { authResult, error in
              if authResult != nil {
                  self.goHome = true
              } else {
                  self.error = error?.localizedDescription
              }
          })
      }
  }
  </code></pre>
  
  <p>SignUp View</p>
  
  <pre><code>struct SignUpScreen: View {
  
      @State
      var firstName: String = ""
      @State
      var lastName: String = ""
      @State
      var birthday: String = ""
      @State
      var number: String = ""
      @State
      var email: String = ""
      @State
      var password: String = ""
      @State
      var confirmPassword: String = ""
  
      @EnvironmentObject
      var viewModel: SignUpViewModel
  
  
      var body: some View {
          ZStack {
              VStack {
                  VClearBackground()
                  Spacer()
              }
              ScrollView {
                  VStack(alignment: .leading) {
                      Group {
                          PreHeaderText(header: "Get Started")
                              .alignmentGuide(.leading, computeValue: { d in
                                  d[.leading]
                              })
                              .padding(EdgeInsets.init(top: 32, leading: 0, bottom: 0, trailing: 0))
                          HeaderText(header: "Create Account")
                          EditText(hint: "Huey", text: $firstName, label: "FIRST NAME", textContentType: UITextContentType.name)
                          EditText(hint: "Freeman", text: $lastName, label: "LAST NAME", textContentType: UITextContentType.name)
                          EditText(hint: "04-19-1994", text: $birthday, label: "BIRTHDAY")
                          EditText(hint: "(281) 456-7890)", text: $number, label: "MOBILE NUMBER", textContentType: UITextContentType.telephoneNumber, keyboardType: UIKeyboardType.phonePad)
                          EditText(hint: "email@exmaple.com", text: $email, label: "EMAIL", textContentType: UITextContentType.emailAddress)
                          EditText(hint: "********", text: $password, label: "PASSWORD", textContentType: UITextContentType.newPassword)
                          EditText(hint: "********", text: $confirmPassword, label: "CONFIRM PASSWORD", textContentType: UITextContentType.newPassword)
                      }
                      Group {
                          if self.viewModel.error != nil {
                              HStack {
                                  Spacer()
                                  Text(viewModel.error ?? "")
                                      .foregroundColor(ColorTheme.error.color)
                                  Spacer()
                              }
                              .padding()
                          }
                          HStack {
                              Spacer()
                              VowerButton(text: "Submit") {
                                  self.viewModel.signUp(firstName: self.firstName, lastName: self.lastName, email: self.email, birthday: self.birthday, phoneNumber: self.number, password: self.password, confirmPassword: self.confirmPassword)
                              }
                              Spacer()
                          }
                          .padding()
  
                          HStack {
                              Spacer()
                              NavigationLink(destination: LoginScreen(), isActive: $viewModel.goToLogin) {
                                  CtaText(text: "Have an account?", cta: "Login") {
                                      self.viewModel.onGoToLoginClicked()
                                  }
                              }
                              .padding()
                              Spacer()
                          }
  
                          Spacer()
                      }
                  }
              }
              .padding(EdgeInsets.init(top: 16, leading: 16, bottom: 16, trailing: 16))
              .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
          }
          .background(LinearGradient(gradient: Gradient(colors: [.black, ColorTheme.brandPurple.color]), startPoint: .top, endPoint: .bottom))
          .edgesIgnoringSafeArea(.all)
      }
  }
  </code></pre>
  
  <p>EditText View</p>
  
  <pre><code>struct EditText: View {
  
      var hint: String
      @Binding
      var text: String
      var label: String = ""
      var defaultValue =  ""
      var textContentType: UITextContentType? = .none
      var keyboardType: UIKeyboardType = .default
  
      private func initializeDefaultValue() {
          DispatchQueue.main.async {
              self.text = self.defaultValue
          }
      }
  
      var body: some View {
          initializeDefaultValue()
          return VStack(alignment: .leading) {
              Text(label).font(.system(size: 12)).bold()
                  .foregroundColor(ColorTheme.text.color)
              HStack {
                  TextField(hint, text: $text)
                  .lineLimit(1)
                  .textContentType(textContentType)
                  .keyboardType(keyboardType)
                      .foregroundColor(ColorTheme.text.color)
              }
              Divider().background(Color(ColorTheme.brandBlue.value))
          }
          .padding(EdgeInsets.init(top: 12, leading: 0, bottom: 8, trailing: 0))
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eUVYr.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eUVYr.gif" alt="Preview"></a></p>