Reputation: 1958
I have an attribute in CoreData used for sorting that is an NSNumber. Currently, all of the values in it are NSNumbers represting integers, ie 1,2,3,4 etc.
However, I now have a reason to add some NSManagedObjects
with intermediate values. Is it possible to store a decimal in an attribute in CoreData with a data type of NSNumber?
For example, I might have one managed object with a sort order of 1 and another with a sort order of 2. I'd like to move one in between and give it a sort order of 1.5.
Is this allowed?
Thanks in advance for any suggestions.
Upvotes: 0
Views: 403
Reputation: 285079
Basically Core Data supports many different types represented by NSNumber
decimal
is represented by NSDecimalNumber
You have to choose the appropriate attribute type in the Core Data model
Upvotes: 2