EngineKit
|
Instance Methods | |
("Please use -firstObject instead") | - DEPRECATED_MSG_ATTRIBUTE |
("Please use -lastObject instead") | - DEPRECATED_MSG_ATTRIBUTE |
(id) | - sample |
(id) | - anyObject |
Alias for -sample. | |
(id) | - objectForKeyedSubscript: |
(void) | - each: |
(void) | - eachWithIndex: |
(void) | - each:options: |
(void) | - eachWithIndex:options: |
(BOOL) | - includes: |
(NSArray *) | - take: |
(NSArray *) | - takeWhile: |
(NSArray *) | - map: |
(NSArray *) | - select: |
(id) | - detect: |
(id) | - find: |
(NSArray *) | - reject: |
(NSArray *) | - flatten |
(NSArray *) | - compact |
(NSString *) | - join |
(NSString *) | - join: |
(NSArray *) | - sort |
(NSArray *) | - sortBy: |
(NSArray *) | - reverse |
(NSArray *) | - intersectionWithArray: |
(NSArray *) | - unionWithArray: |
(NSArray *) | - relativeComplement: |
(NSArray *) | - symmetricDifference: |
(id) | - reduce: |
(id) | - reduce:withBlock: |
(NSArray *) | - unique |
- (NSArray *) compact |
Remove all the nulls from array
- ("Please use -firstObject instead") DEPRECATED_MSG_ATTRIBUTE |
The first item in the array, or nil.
- ("Please use -lastObject instead") DEPRECATED_MSG_ATTRIBUTE |
The last item in the array, or nil.
- (id) detect: | (BOOL(^)(id object)) | block |
Iterate through current array returning the first element meeting a criteria.
block | A block that returns YES/NO |
- (void) each: | (void(^)(id object)) | block |
A simpler alias for enumerateObjectsUsingBlock
block | A block with the object in its arguments. |
- (void) each: | (void(^)(id object)) | block | |
options: | (NSEnumerationOptions) | options | |
A simpler alias for enumerateObjectsWithOptions:usingBlock:
block | A block with the object in its arguments. |
options | Enumerating options. |
- (void) eachWithIndex: | (void(^)(id object, NSUInteger index)) | block |
A simpler alias for enumerateObjectsUsingBlock
which also passes in an index
block | A block with the object in its arguments. |
- (void) eachWithIndex: | (void(^)(id object, NSUInteger index)) | block | |
options: | (NSEnumerationOptions) | options | |
A simpler alias for enumerateObjectsWithOptions:usingBlock:
which also passes in an index
block | A block with the object in its arguments. |
options | Enumerating options. |
- (id) find: | (BOOL(^)(id object)) | block |
Alias for detect
. Iterate through current array returning the first element meeting a criteria.
block | A block that returns YES/NO |
- (NSArray *) flatten |
Recurse through self checking for NSArrays and extract all elements into one single array
- (BOOL) includes: | (id) | object |
An alias for containsObject
object | An object that the array may or may not contain. |
- (NSArray *) intersectionWithArray: | (NSArray *) | array |
Return all the objects that are in both self and array
. Alias for Ruby's & operator
- (NSString *) join |
Alias for componentsJoinedByString
with a default of no seperator
- (NSString *) join: | (NSString *) | separator |
Alias for componentsJoinedByString
seperator
string - (NSArray *) map: | (id(^)(id object)) | block |
Iterate through the current array running the block on each object and returning an array of the changed objects.
block | A block that passes in each object and returns a modified object |
- (id) objectForKeyedSubscript: | (id< NSCopying >) | key |
Allow subscripting to fetch elements within the specified range
key | An NSString or NSValue wrapping an NSRange. It's intended to behave like Ruby's array range accessors. Given array of 10 elements, e.g. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], you can perform these operations: array[@"1..3"] will give you [2, 3, 4] array[@"1...3"] will give you [2, 3] (last value excluded) array[@"1,3"] implies NSRange(location: 1, length: 3), and gives you [2, 3, 4] |
- (id) reduce: | (id(^)(id accumulator, id object)) | block |
Return a single value from an array by iterating through the elements and transforming a running total.
- (id) reduce: | (id) | initial | |
withBlock: | (id(^)(id accumulator, id object)) | block | |
Same as -reduce, with initial value provided by yourself
- (NSArray *) reject: | (BOOL(^)(id object)) | block |
Iterate through current array asking whether to remove each element.
block | A block that returns YES/NO for whether the object should be removed |
- (NSArray *) relativeComplement: | (NSArray *) | array |
Return all the objects in self that are not in array
. Alias for Ruby's - operator
array
- (NSArray *) reverse |
Alias for reverseObjectEnumerator.allObjects
Returns a reversed array
- (id) sample |
A random element in the array, or nil.
- (NSArray *) select: | (BOOL(^)(id object)) | block |
Iterate through current array asking whether to keep each element.
block | A block that returns YES/NO for whether the object should stay |
- (NSArray *) sort |
Run the default comparator on each object in the array
- (NSArray *) sortBy: | (NSString *) | key |
Sorts the array using the the default comparator on the given key
- (NSArray *) symmetricDifference: | (NSArray *) | array |
Return all the objects that are unique to each array individually Alias for Ruby's ^ operator. Equivalent of a - b | b - a
- (NSArray *) take: | (NSUInteger) | numberOfElements |
Take the first numberOfElements
out of the array, or the maximum amount of elements if it is less.
numberOfElements | Number of elements to take from array |
- (NSArray *) takeWhile: | (BOOL(^)(id object)) | block |
Passes elements to the block
until the block returns NO, then stops iterating and returns an array of all prior elements.
block | A block that returns YES/NO |
- (NSArray *) unionWithArray: | (NSArray *) | array |
Return all the objects that in both self and array
combined. Alias for Ruby's | operator
- (NSArray *) unique |
Produces a duplicate-free version of the array