Reputation: 762
I have an object, EventReminder
, that contains 2 Set objects:
var importantDates: Set<NSDate>
var recurringDays: Set<DayOfWeek>
.
.
.
enum DayOfWeek: Int {
case Sunday = 0
case Monday
case Tuesday
case Wednesday
case Thursday
case Friday
case Saturday
}
I want to convert this to CoreData but I'm having trouble mapping it all out. My class has a many-to-many relationship with NSDate(via importantDates) and DayOfWeek(via recurringDays).
Do I:
make 2 classes of importantDates
and recurringDays
that hold only 1 property each: NSDate
and DayOfWeek
?
create a relationship between EventReminder
and these 2 classes?
DayOfWeek
compliant to NSCoding? (not really sure if this is even possible)Am I on the right track for the solution or is there a better way to do this?
Upvotes: 0
Views: 35
Reputation: 11993
Don't make a seperate NSManagedObject just to hold an NSDate or an enum.
You can store a Set in CoreData, just make the type transformable with custom class Set.
Upvotes: 2