title: SwiftUI view is not updating to EnvironmentObject change
body: <p>I'm creating a SwiftUI app that includes Firebase to enable logging into an account, extremely simple, just a ui form with password and email fields, then a button to submit. Once the user signs in I store the firebase user object in an EnvironmentObject so the rest of the views will have access to it. The problem with the app currently is that once the user logs in and the user data is stored in the EnvironmentObject, the view is supposed to update to the changed state of this to show a different screen, but it seems the view still thinks the EnvironmentObject is equal to nil. Do views not automatically change to updates in an EnvironmentObject like they do for state variables perhaps? </p>
  
  <p>I've made sure the EnvironmentObject is setup properly and passed to both the preview and SceneDelegate</p>
  
  <p>Made sure that the app is indeed successfully logging in the user by printing account information to the console upon sign in, yet the view itself will only display nil for account information, it seems it wont access the updated EnvironmentObject with the user info. </p>
  
  <pre><code>import SwiftUI
  import Firebase
  import Combine
  
  struct ContentView: View {
  
      @EnvironmentObject var session: SessionStore
  
      @State var emailTextField: String = ""
      @State var passwordTextField: String = ""
  
      @State var loading = false
      @State var error = false
  
      var body: some View {
          VStack {
              if (session.session != nil) {
                  Home()
              } else {
                  Form {
                      TextField("Email", text: $emailTextField)
                      SecureField("Password", text: $passwordTextField)
                      Button(action: signIn) {
                          Text("Sign in")
                      }
                  }
  
                  Text("Session: \(session.session?.email ?? "no user")")
              }
          }.onAppear(perform: getUser)
      }
  
      func getUser () {
          session.listen()
      }
  
      func signIn () {
          loading = true
          error = false
          session.signIn(email: emailTextField, password: passwordTextField) { (result, error) in
              self.loading = false
              if error != nil {
                  self.error = true
              } else {
                  self.emailTextField = ""
                  self.passwordTextField = ""
              }
          }
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView().environmentObject(SessionStore())
      }
  }
  
  
  
  class SessionStore : ObservableObject {
  
      var didChange = PassthroughSubject&lt;SessionStore, Never&gt;()
      var session: User? { didSet { self.didChange.send(self) }}
      var handle: AuthStateDidChangeListenerHandle?
  
      func listen () {
          // monitor authentication changes using firebase
          handle = Auth.auth().addStateDidChangeListener { (auth, user) in
              if let account = user {
                  // if we have a user, create a new user model
                  print("Got user: \(account)")
                  self.session = User(
                      uid: account.uid,
                      displayName: account.displayName,
                      email: account.email
                  )
                  print("Session: \(self.session?.email ?? "no user")")
              } else {
                  // if we don't have a user, set our session to nil
                  self.session = nil
              }
          }
      }
  
      func signUp(
          email: String,
          password: String,
          handler: @escaping AuthDataResultCallback
          ) {
          Auth.auth().createUser(withEmail: email, password: password, completion: handler)
      }
  
      func signIn(
          email: String,
          password: String,
          handler: @escaping AuthDataResultCallback
          ) {
          Auth.auth().signIn(withEmail: email, password: password, completion: handler)
      }
  
      func signOut () -&gt; Bool {
          do {
              try Auth.auth().signOut()
              self.session = nil
              return true
          } catch {
              return false
          }
      }
  
      func unbind () {
          if let handle = handle {
              Auth.auth().removeStateDidChangeListener(handle)
          }
      }
  }
  
  class User {
      var uid: String
      var email: String?
      var displayName: String?
  
      init(uid: String, displayName: String?, email: String?) {
          self.uid = uid
          self.email = email
          self.displayName = displayName
      }
  
  }
  </code></pre>
  
  <p>As you can see in the view, it is supposed to render login fields when user is not logged in, and when the user is logged in the view should display another view. That other view is not displaying.</p>