title: How to retrieve current logged in user data?
body: <p>hello I'm trying to retrieve the user's first name to show it in the main page after login (I'll assign it to UILabel).</p>
  <p>My database:
  <img src="https://i.stack.imgur.com/jXQF3.png" alt="enter image description here" /></p>
  <p>This is the code I'm trying :</p>
  <pre><code>let id = Auth.auth().currentUser!.uid
  func getName(Completion: @escaping((String) -&gt; ())) {
     let DocRefernce:DocumentReference!
     DocRefernce = db.collection(&quot;users&quot;).document(id)
     DocRefernce.getDocument { (docSnapshot, error) in
         if error != nil {
             print(error!)
         } else {
             guard let snapshot = docSnapshot, snapshot.exists else { return }
             guard let data = snapshot.data() else { return }
             let firstname = data[&quot;FirstName&quot;] as? String ?? &quot;No name&quot;
             Completion(firstname)
             
         }
     }
  }
  </code></pre>
  <p>and I'm calling the method in <code>override func viewDidLoad()</code></p>
  <pre><code>getName{ [self] (name) in
     fullName.text = name
  }
  </code></pre>
  <p>I'm using swift with cloud firestore and I'm new to it I appreciate any help</p>