Reputation: 99
I want to create child id from text input when user register.
how to change chidbyautoid to a user input id
Upvotes: 0
Views: 207
Reputation:
Try this:
var username = [String:AnyObject]()
username["username"] = usernametextfield!.text //outlet of username textfield
var userinput = userinputtextfield!.text //outlet of input textfield
self.ref.child("users").child("\(userinputid)").setvalue(username)
Upvotes: 0
Reputation: 99
self.ref.child("users").child((Auth.auth().currentUser?.uid)!).setValue(["username": fname])
This Works Fine
Upvotes: 1
Reputation: 46
Just use self.ref.child("users").child(user.uid).setValue(["username": fname])
.
Replace user.uid
with your custom user input.
Upvotes: 0