title: How to retrieve data from current User in Firebase using Swift?
body: <p>I am trying to get current users firstname from firebase using swift code. Below is my JSON file and swift code. But it's not retrieving first name. Please suggest</p>
  
  <p><a href="https://i.stack.imgur.com/BVubg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BVubg.png" alt="JSON structure"></a>Json:</p>
  
  <p>Swift code:</p>
  
  <pre><code>  if FIRAuth.auth()?.currentUser != nil{
  
          let queryRef = FIRDatabase.database().reference().child("expatsappmembers")
  
  
          let userID : String = (FIRAuth.auth()?.currentUser?.uid)!
          print("Current user ID is" + userID)
  
          queryRef.child("uid").child(userID).observeSingleEvent(of: .value, with: {(snapshot) in
              print(snapshot.value)
  
              let userName = (snapshot.value as! NSDictionary)["firstname"] as! String
              print(userName)
  
  
          })
  
      }
  </code></pre>