Can collection operators be used on primitive values?
I have an object that has a primitive property duration.
@property (nonatomic) NSTimeInterval duration;
I have an NSArray of those said objects and I would like to use a collection operation on the array to get the sum of the durations. The problem is that @"@sum.duration" expects an NSNumber instead.
Will I have to do this the old fashioned way, or is there a way to use primitives?
From "Scalar and Structure Support" in the "Key-Value Coding Programming Guide":
So
just works, even if
durationis a scalar property. Small self-contained example:Output: 580.1.