How should I use ObservableObject

Hi Devs! I have my Firestore database set up and I want to have a reusable SwiftUI view for it. I asked a question about this and someone said use ObservableObject. I surfed the web and could not find any tutorials.

I would like it so my view's title changes to a value from the database.
This is the code to read the database:
Code Block language
let docRef = db.collection("houses").document("\(houseId)")
  docRef.getDocument { (document, error) in
            if let document = document, document.exists {
                let dataDescription = document.data().map(String.init(describing:)) ?? "nil"
                print("Document data: \(dataDescription)")
                self.title = dataDescription
            
            } else {
                print("Document does not exist")
            }
}



How can I make dataDescription the text of a label?

This is the code to read the database:

Where does that code exist?
How should I use ObservableObject
 
 
Q