I am attempting a project just for fun, I would like to use Firebase. I made a class to user for user related things. I was testing the signing up function and when it is within
Your issue is that the createUser
method is asynchronous. You are returning made
from your function before createUser
finishes.
func createAccount()-> Bool {...}
should be
func createAccount(completion: (Bool)->Void) {...}
And then when the Firebase Auth call to createUser completes, you call completion(made)
.
You will need to read up on asynchronous calls in programming and closures in swift to understand better. You can start with something like this article.