Guest User

Untitled

a guest
Feb 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. let rootRef = Database.database().reference()
  2. let user = Auth.auth().currentUser
  3.  
  4. userRef.child(user!.uid).observeSingleEvent(of: DataEventType.value,
  5. with: {
  6. (snapshot: DataSnapshot) in
  7. print("ExistsUser:childrenCount: %@", snapshot.childrenCount) // ①
  8. ret = true
  9. })
  10. if ( ret == false ) {
  11. userRef.child(user!.uid).setValue(["username": user?.displayName]) // ②
  12. }
Add Comment
Please, Sign In to add comment