Trying to store currency, that can be in the negative/postive, with decimals. I’ve done much searching and found that using Decimal type in the model is the best way. That doesn’t seem to be signed thought. I see you can store a signed integer (no decimals). But I can’t find any info on storing a signed, decimal number.
Since I’m not finding anything, I’m guessing you can’t.
If so, how do you go about storing this kind of info? Create a boolean attribute that describes if the amount is neg/pos?
The “Decimal” type in CoreData uses the SQLite “Decimal” storage class, which is backed by the “Real” storage class.
This will support negative numbers at the store level:
As you can see, SQLite correctly stores the value.
In your objective C code you will be working with the NSNumber class, which can be instantiated with negative decimals using the following code: