What is this syntax when I was attempting to override a getter??
I\'m just messing around trying to learn more about how properties work in Objective-C. Here is my
It's called "Getter Indexed Accessors" as explained in the Key-Value Coding Programming Guide
From the documentation:
In order to support read-only access to an ordered to-many relationship, implement the following methods:
-countOf<Key>
Required. This is the analogous to the NSArray primitive method count.
-objectIn<Key>AtIndex:
or-<key>AtIndexes:
One of these methods must be implemented. They correspond to the NSArray methodsobjectAtIndex:
andobjectsAtIndexes:
-get<Key>:range:
Implementing this method is optional, but offers additional performance gains. This method corresponds to theNSArray
methodgetObjects:range:
.
You can implement such methods for performance reasons, as explained in the guide
If benchmarking indicates that performance improvements are required, you can also implement
-get<Key>:range:
. Your implementation of this accessor should return in the buffer given as the first parameter the objects that fall within the range specified by the second parameter.
As an example
- (void)getEmployees:(Employee * __unsafe_unretained *)buffer range:(NSRange)inRange {
// Return the objects in the specified range in the provided buffer.
// For example, if the employees were stored in an underlying NSArray
[self.employees getObjects:buffer range:inRange];
}