views:

31

answers:

1

This is a design questions, so multiple ideas will be fine.

In my iPhone app, I keep track of Multiple players' life, which can increase and decrease over time. After the game is done, I want to be able to show them their life throughout the game, so they can see how they did. Now, this will also be stored in Core Data, so they can look over their past games and see how they did.

So, the question is this: What is the best way to do it? I would like this information present in the life log:

time: Player Name - Current Life (Change in Life)

Where those variables would be stored and would be pulled out to display the list. So what's the best way to do this? Should I make a "Life Change" entity in Core Data and have many many of these lines in it? Or is there a better way?

Thanks for your advice!

A: 

Have a life entity that is hanging off of a one to many relationship that stores the data that is needed. Then when you display the data, turn those objects into text to display to the user, there is no reason to store thar kind of information as raw text in core data when you just need to store the variables.

Marcus S. Zarra
I ended up using your suggestion of a One to Many relation in Core Data, although I did store each "line" as a string and not as the individual parts. I did this so I could more effectively sort the outcome, I didn't realize that the one to many relations were stored in a Set.Anyways, thank you for pointing me in the right direction, and you helped a lot!
Wayfarer