-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
Description
Description
Now as we convert our project to Swift Concurrency and Swift 6 we came across the warning Capture of 'listener' with non-sendable type 'any ListenerRegistration' in a '@sendable' closure:
import FirebaseDatabase
func coolStream() -> AsyncStream<[Stuff]>{
return AsyncStream { continuation in
let collection: String = "cool"
let db = Firestore.firestore()
let listener = db.collection(collection)
.addSnapshotListener(
listener: { snapshot, error in
guard let snapshot else {
return
}
let results: [Stuff] = snapshot.documents
.map({ try? $0.data(as: Stuff.self) })
.compactMap({ $0 })
continuation.yield(results)
})
continuation.onTermination = { _ in
listener.remove() // <<<-- ERROR/WARNING Capture of 'listener' with non-sendable type 'any ListenerRegistration' in a '@Sendable' closure
}
}
}
To silence this we could add @preconcurrency but we also loose sight of these warnings then.
Therefore my question: Is there a specific timeline for when this model object will become Sendable?
I tested with version 11.7.0 today and still get this.
API Proposal
No response
Firebase Product(s)
Database
API Proposal
No response
Firebase Product(s)
Firestore