Jason Tremain Jason Tremain - 3 months ago 13
Swift Question

Write Firebase Auth User UID to database

Currently I have my app making user profiles and generating an autoID to my database using the following:

databaseRef.child("users").childByAutoId().setValue(user)


Instead of using .childByAutoID, I'd like that to be the User UID that's generated using the Firebase User UID value, however I'm not sure how to swap that into my code above.

Answer
databaseRef.child("users").child(FIRAuth.auth()!.currentUser!.uid).setValue(user)