[英]Using async/await (Swift 5.5) with firebase Realtime Databse
I use firebase's Realtime Database to make asynchronous database queries from my app.我使用 firebase 的实时数据库从我的应用程序中进行异步数据库查询。 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.
现在 iOS 15 为我们提供了 Swift 5.5,我喜欢使用async/await来执行这些查询,而不是传递完成闭包。
I know that I can use await withCheckedThrowingContinuation { }
to build async versions from the existing firebase functions.我知道我可以使用
await withCheckedThrowingContinuation { }
从现有的 firebase 函数构建异步版本。 But do async versions already exist?但是异步版本已经存在了吗? Either in firebase or auto-synthesized by Xcode?
在 firebase 中还是由 Xcode 自动合成?
Many of the Realtime Database asynchronous APIs are available via Xcode's auto-synthesizing.许多实时数据库异步 API 都可以通过 Xcode 的自动合成获得。
They will show up in Xcode auto-completion.它们将出现在 Xcode 自动完成中。
There are several examples visible at https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseDatabase/Tests/Unit/Swift/DatabaseAPITests.swift https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseDatabase/Tests/Unit/Swift/DatabaseAPITests.swift有几个例子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.