Open b-mahjour opened 4 years ago
And my listen in sessionstore for reference as well:
func listen () {
// monitor authentication changes using firebase
handle = Auth.auth().addStateDidChangeListener { (auth, user) in
if let user = user {
// if we have a user, create a new user model
print("Got user: \(user)")
self.isLoggedIn = true
self.session = User(
uid: user.uid,
displayName: user.displayName,
email: user.email
)
} else {
// if we don't have a user, set our session to nil
self.session = nil
self.isLoggedIn = false
}
}
}
Hi @b-mahjour, try putting @Published
before the var session: User?
line in Session.swift
here:
https://github.com/bmcmahen/julienne-swift/blob/master/julienne/Session.swift#L49
Adding @Published
worked for me. I added it to isLoggedIn
as well.
Any reason we can't use isLoggedIn
instead of session != nil
? Seems to work well and I prefer using truthy statements over checking for nil.
Hi, thanks so much for your code. It's been really helpful. I'm having an issue with the sign in. Basically my contentview.swift is identical to yours:
As well as my signinview:
However, when I test signing it, there is no error and the email and password become blank, but it remains on the sign in view page instead of displaying "signed in" as I believe it should. I've compared everything to the code you have online and it seems to be identical. What am I missing?
Thanks again!