0
votes

So I understand you need NSNumber to save integers in Core Data.

My question is what is the best technique for accessing the integers here, performing maths, and then updating?

For example should you basically always convert the NSNumber to an NSInteger straight away (using the NSNumber intValue method I would guess), do maths/calculations, and then at the last minute create a new NSNumber and save back to core data?

1

1 Answers

1
votes

You are right, Greg. Since we get the values to be plotted from the array which is either NSArray or NSMutableArray, we cant store integer in NSArray, because int is not an object. Whereas, NSNumber is an object. and thats why we convert it to NSNumber and store it after doing the calculations.

Also, as Eric mentioned in one of his answers, For the plot data, you can provide any NSNumber instance. Core Plot supports NSDecimalNumber as well and will use higher-precision calculations when drawing the graph, although this comes at a performance cost.