I followed the directions on the firebase website and came up with the code below labeled NEW CODE. The error I am getting is:

Cannot invoke initializer for type 'Result' with an argument list of type '(@escaping () throws -> CombinedModel?)'

I have tried researching about the Result object and this error but have not found anything that would help me directly. I was able to read the data using the old way (which I will post below), but am trying to follow Googles documentation 
(<https://firebase.google.com/docs/firestore/query-data/get-data>)

Any help would be appreciated, thank you!

OLD CODE

```
func readData(word: String) -> CombinedModel? {
        print("reading data")
        let docRef = db.collection(K.FBConstants.dictionaryCollectionName).document(word)
        var wordResults: CombinedModel? = nil

        docRef.getDocument { (document, error) in
            if let e = error {
                print("Error loading data: \(e)")
                return
            } else {

                do {
                    if let resultData = try document?.data(as: CombinedModel.self){
                        print("Definitions: \(resultData.definitionsArray)")
                        print("\n Synonyms: \(resultData.synonyms)")
                        wordResults = resultData
                    }
                } catch {
                    print("Error decoding: \(error)")
                }
            }
        }
        return wordResults
    }

```

NEW CODE

```
    func newReadData(word: String) -> CombinedModel? {
        let docRef = db.collection(K.FBConstants.dictionaryCollectionName).document(word)

        docRef.getDocument { (document, error) in
            let result = Result {
                try document.flatMap {
                    try $0.data(as: CombinedModel.self)
                }
            }
            switch result {
            case .success(let combinedModel):
                if let combinedModel = combinedModel {
                    print("CombinedModel: \(combinedModel)")
                } else {
                    print("Document does not exist")
                }
            case .failure(let error):
                print("Error decoding city: \(error)")
            }
        }
    }

```

Here is the codable custom class I created for reading the data.

```
struct CombinedModel: Codable {
    var definitionsArray: [WordModel]
    var synonyms: [String]

    private enum CodingKeys: String, CodingKey {
        case definitionsArray
        case synonyms
    }
}

struct WordModel: Codable {

    let id: String
    let partOfSpeech: String
    let definitions: [String]
    let example: [String]
    let ipa: String
    let audio: String

    private enum CodingKeys: String, CodingKey {
        case id
        case partOfSpeech
        case definitions
        case example
        case ipa
        case audio
    }
}

struct ThesaurusModel: Codable {

    var synonyms: [String]

    private enum CodingKeys: String, CodingKey {
        case synonyms
    }
}

```