I really hope this gets addressed in #WWDC25.
Using a rawValue, you need to hardcode the rawValue, even the below wouldn't compile.
#Predicate<Train> { $0.statusRawValue == Status.onTime.rawValue }
Error:
Key path cannot refer to enum case 'status'
If the intent of SwiftData is to be modern and not expose the constraints of SQLite, then more needs to be done to improve support more swift types.
Using a #Predicate seems like a blackbox, it works for simple primitive type comparisons but doesn't even work when trying to compare with something like Status.onTime.rawValue
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: