Firebase Storage / Google Places - async - await support

Viewed 195

I am moving my swift project to Swift 5.5, taking advantage of async await and trying to learn the syntax effectively while I am at it.

I have been successful so far in moving some functions across - those within the FirebaseFirestore database: ".getDocuments()" and ".setData".

In these instances, the compiler recognizes what I am trying to do and suggests the 'async throws' version of the method, leaving out the completion parameter / closure. See screen shot here: Xcode giving me the option to use async throws instead of a closure.

When I try to do the same thing with FirebaseStorage method ".getData" I am not presented with such an option, and in fact, adding "try await" with a "do / catch" gives my the compiler error: "Missing argument for parameter 'completion' in call"

I also utilize the GooglePlaces API in my project, and the same thing happens here when I call the ".findAutocompletePredictions" and the ".fetchPlace". In these examples the compiler throws "Missing argument for parameter 'callback' in call"

How can I write these network calls using swift 5.5 async await?

0 Answers
Related