Q:

Firestore data loads every time when moving to different view controllers

func loadUserThings() { 

        Firestore.firestore().collection("users").document((Auth.auth().currentUser?.uid)!).getDocument { (snapshot, error) in
            if let document = snapshot {
                var data = document.data()
                self.nameLabel.text = data?["username"] as? String ?? ""
                self.usernameLabel.text = data?["username"] as? String ?? ""
            }
    }

}

The above function is called in the viewdidLoad() of the view controller.
I am retrieving data from firebase firestore. When I move between view controllers or open the app the labels are loaded again. The data is caching as i can see it when there is no internet but even then it takes time to load.
Firestore Data Loading every time in labels

A:

This type of thing happens when you are using getData function of Firestone. 
Using a snapshot listener will remove this issue.

