Help, I need to save an object in CoreData

Hi, I am trying to save and retrieve an object in coredata with the following attributes: id, classification de tipo String, values de tipo [(Double, Double)], but I don't know how to save values:[(Double, Double)].

Thanks, greetings.

Replies

If you need several data items in a database table (as array in your case), the usual solution is to have two tables with a one-to-many relation to the other table having the multiple values.

In Xcode core data modelling terms, you'd have two entities and a one-to-many relationship between them.

Alternatively, you could do this in code, storing e.g. a comma separated string of elements in a string attribute. But then you'd have to implement parsing and generating this string yourself in code.