title: Why update variable in observable object does not update the view?
body: <p>I am new to SwiftUI. Learning new properties such as @State, @Binding, @EnvironmentObject etc. </p>
  
  <p>I am currently working on the login template, define a binding @Published variable in observable object which allows to switch between login page and main page. However, when I update the variable inside the observable object, the main page does not show up. It is still in the login page. What is missing in my code?</p>
  
  <pre><code>
  struct ContentView: View {
  
      @EnvironmentObject var loginViewModel: LoginViewModel
  
  
  
      var body: some View {
  
          return Group {
              if loginViewModel.signInSuccess {
                  MainPageView()
              }
              else {
                  LoginView(signInSuccess: $loginViewModel.signInSuccess).environmentObject(LoginViewModel())
              }
          }
  
  
      }
  
  
  }
  
  
  </code></pre>
  
  <pre><code>
  final class LoginViewModel: ObservableObject  {
        @Published var signInSuccess:Bool = false;
  
        func performLogin() {
             signInSuccess = true;
        }
  
  }
  
  </code></pre>
  
  <pre><code>
  struct LoginView: View {
  
      @EnvironmentObject var loginViewModel: LoginViewModel
  
      @Binding var signInSuccess: Bool;
  
      var body: some View {
  
          Button(action: submit) {
                  Text("Login")
                      .foregroundColor(Color.white)
  
          }
  
      }
  
      func submit() {
          loginViewModel.performLogin()
          // signInSuccess = true;
      }
  
  
  }
  
  </code></pre>
  
  <p>If I tried to update binding 'signInSuccess' in the loginView, it can successfully update the view to the mainView. However, is there a way that I can update signInSuccess inside the Observable Object that also update the ContentView to the MainView?</p>