Home > Enterprise >  Using async/await (Swift 5.5) with firebase Realtime Databse
Using async/await (Swift 5.5) with firebase Realtime Databse

Time:11-26

I use firebase's Realtime Database to make asynchronous database queries from my app. Now that iOS 15 gives us Swift 5.5, I'd love to use async/await to perform those queries instead of passing completion closures.

I know that I can use await withCheckedThrowingContinuation { } to build async versions from the existing firebase functions. But do async versions already exist? Either in firebase or auto-synthesized by Xcode?

CodePudding user response:

Many of the Realtime Database asynchronous APIs are available via Xcode's auto-synthesizing.

They will show up in Xcode auto-completion.

There are several examples visible at https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseDatabase/Tests/Unit/Swift/DatabaseAPITests.swift

  • Related