SwiftData Predicate Not Support Enum
 SwiftData Predicate Not Support Enum 
 1
Query encountered an error: Unsupported Predicate: Captured/constant values of type 'DayPhase' are not supported
Failure1
1
2
3
4
5
6
7
let night = DayPhase.night  
_lastNightLogs = Query(filter: #Predicate<FoodLog> {  
            ($0.occurredAt >= yesterdayStart) &&  
            ($0.occurredAt < todayStart) &&  
            ($0.dayPhase == night)  
        })
Failure2
1
2
3
4
5
6
7
let nightRawValue = DayPhase.night.rawValue  
_lastNightLogs = Query(filter: #Predicate<FoodLog> {  
            ($0.occurredAt >= yesterdayStart) &&  
            ($0.occurredAt < todayStart) &&  
            ($0.dayPhase.rawValue == nightRawValue)  
        })
 This post is licensed under  CC BY 4.0  by the author.