I'm making an Instagram clone, and am wanting to get the username for the user to display. The info is in the Database section of firebase, and I'm trying to do it via a snapshot, but it always returns .
fileprivate func fetchUser() {
guard let uid = Auth.auth().currentUser?.uid else { return }
Database.database().reference().child("users").child(uid).observeSingleEvent(of: .value, with: { (snapshot) in
print(snapshot.value ?? "")
}) { (err) in
print("Failed to fetch user:", err)
}
}
The code format is spaced weird, but thats the code. Am I not getting the Childs right, or what's going on?
EDIT: also here is a snapshot of Firebase Db.Firebase screenshot