I am using Core Data and one of my predicates retrieves data based on the following enum:
enum Period : Int {
Daily
Weekly
Monthly
}
My predicates is like this:
public static func byTypePredicate(periods: [Int]) -> NSPredicate {
return NSPredicate(format: "period IN %@", periods)
}
My problem is I don't want to use Int's when calling this predicate, I want to pass the Period enum, but inside the predicate is have to convert it to Int to make it work.
Is there a quick way to convert it ?
periods.rawValue?daily,weekly,monthly.