views:

37

answers:

1

I'm not sure whether or not this is the appropriate way of doing this, but I was wondering what's the best way to approach a relationship to a value in a list with Core Data? For example, say you have a 'person' entity. Each person can have a different 'hair color'. I'm trying to basically define the hair colors in my data model and allow the 'person' entity to have a relationship to their given 'hair color.

Is this possible? Good idea or bad?

Thanks in advance.

+1  A: 

Create a HairColor entity, and use a to-one hairColor relationship in Person?

You could then create the hair colors you want on app launch if they don't already exist. Sounds to me to be a similar thing to when you populate an outline view with default items on app launch if needed (assuming the outline view uses Core Data, of course).

Enchilada
That sounds like a great idea. Thanks for the suggestion!
Dylan Copeland