Reputation: 13840
I have an NSManagedObject with options
property of type NSString
. but the response I receive from server for this property is in NSArray. I want a custom mapper to convert this array to a a concatenated string.
if want to post this object to the server I need convert back this string to NSSArray.
How can I achieve that?
I don't want define an entity named Options
and define a relationship between these objects.
options:
{
red,
green,
blue,
}
||
\/
options = "red, green, blue";
Upvotes: 1
Views: 160
Reputation: 119031
I would consider storing options
as a transformable so that it is stored directly as an NSArray
, and then have a transient property which is the string version of this, created and cached as required. Then you have access to the information in both formats and you can use each as required.
Upvotes: 2