Я не могу использовать макрос #Predicate для простого условия.
for point in pendingList {
do {
let predicate: Predicate = #Predicate {
$0.lat == point.lat //It throws error, I will attach error at bottom.
}
// Create a FetchDescriptor with the predicate
let descriptor = FetchDescriptor(predicate: predicate)
if let matchedPoint = try modelContext?.fetch(descriptor).first {
modelContext?.delete(matchedPoint)
}
} catch {
print("Error saving model object:", error)
}
}
ОШИБКА:-
Cannot convert value of type 'PredicateExpressions.Equal' to closure result type 'any StandardPredicateExpression'
Подробнее здесь: https://stackoverflow.com/questions/784 ... -condition