Hi,
I have the following predicate used in a SwiftData Query:
#Predicate<Item> {
searchText.isEmpty || $0.myarray.contains(where: {
$0.text.localizedStandardContains(searchText)
})
})
Even though this compiles, I get the unsupportedKeyPath error in the logs:
Query encountered an error: SwiftData.SwiftDataError(_error: SwiftData.SwiftDataError._Error.unsupportedKeyPath)
I thought I could use .contains(where:)
inside predicates, but this doesn't work. What could be the problem?
Item.myarray
is an array of a Codable struct type, and searchText is a String
.