Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rootRef = Database.database().reference()
- let user = Auth.auth().currentUser
- userRef.child(user!.uid).observeSingleEvent(of: DataEventType.value,
- with: {
- (snapshot: DataSnapshot) in
- print("ExistsUser:childrenCount: %@", snapshot.childrenCount) // ①
- ret = true
- })
- if ( ret == false ) {
- userRef.child(user!.uid).setValue(["username": user?.displayName]) // ②
- }
Add Comment
Please, Sign In to add comment