I’ve enabled Xcode ‘strict concurrency checking’ and am now getting errors on the sample data model of a Post.
struct Post: Identifiable, Codable {
@DocumentID var id: String?
var title: String
var content: String
var timestamp: Date
}
func firebaseQuery(queries: [String], queryField: String) async throws -> [Post] {
var results = [Post]()
try await withThrowingTaskGroup(of: [Post].self) { group in
for query in queries {
group.addTask { [self] in
return try await getPostsFromFirebase(query: query, queryField: queryField)
}
}
for try await result in group {
results.append(contentsOf: result)
}
}
return results
}
Error "Type 'Post' does not conform to the 'Sendable' protocol"
Adding Sendable compliance to Post gives this error:
Stored property '_id' of 'Sendable'-conforming struct 'PostSendable' has non-sendable type 'DocumentID<String>'
How do I make Post comply to Sendable, or work with it not being Sendable?
Thanks