I'm trying to migrate over to the Swift 6 language mode, but the biggest issue I'm facing is that any use of SwiftData #Predicate or SortDescriptor results in this warning from the compiler:
Type 'ReferenceWritableKeyPath<GuruSchemaV2.Rubric, Bool>' does not conform to the 'Sendable' protocol; this is an error in the Swift 6 language mode
Here is an example predicate, from a static method on the Rubric
type:
static func notArchived() -> Predicate<Rubric> {
return #Predicate<Rubric> { rubric in
!rubric.archived
}
}
And the error highlights line 5 of the expanded macro:
Foundation.Predicate<Rubric>({ rubric in
PredicateExpressions.build_Negation(
PredicateExpressions.build_KeyPath(
root: PredicateExpressions.build_Arg(rubric),
keyPath: \.archived
)
)
})
What is the correct way to reference properties of a model type using #Predicate?