|
FoundationExtension
FoundationExtension is common Foundation/UIKit/Cocoa shortcuts and snippets collection.
|
See Map/Filter/Reduce for concept of functional tools. More...
Go to the source code of this file.
Classes | |
| category | NSEnumerator(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSArray(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSMutableArray(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSDictionary(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSMutableDictionary(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSSet(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSOrderedSet(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
| category | NSCountedSet(Functional) |
| See Map/Filter/Reduce for concept of functional tools. More... | |
Typedefs | |
| typedef void(^ | NSAObjectProcedure )(id obj) |
| Procedure take an object. Take an object and execute job. More... | |
| typedef void(^ | NSAObjectProcedureWithIndex )(id obj, NSUInteger index) |
| Procedure take an object with index. Take an object and execute job. More... | |
| typedef void(^ | NSAObjectProcedureWithKey )(id obj, id key) |
| Procedure take an object with key. Take an object and execute job. More... | |
| typedef id(^ | NSAObjectUnaryOperator )(id obj) |
| Object unary operation block. Take an object and returns an object. More... | |
| typedef id(^ | NSAObjectUnaryOperatorWithIndex )(id obj, NSUInteger index) |
| Object unary operation block. Take an object with index and returns an object. More... | |
| typedef id(^ | NSAObjectUnaryOperatorWithKey )(id obj, id key) |
| Object unary operation block. Take an object with key and returns an object. More... | |
| typedef BOOL(^ | NSAObjectPicker )(id obj) |
| Object selection block. Take an object and returns a boolean. More... | |
| typedef BOOL(^ | NSAObjectPickerWithIndex )(id obj, NSUInteger index) |
| Object selection block. Take an object with index and returns a boolean. More... | |
| typedef BOOL(^ | NSAObjectPickerWithKey )(id obj, id key) |
| Object selection block. Take an object with key and returns a boolean. More... | |
| typedef id(^ | NSAObjectBinaryOperator )(id obj1, id obj2) |
| Object binary operation block. Take 2 objects and returns an object. More... | |
| typedef void(^ | NSAObjectProcedureWithCount )(id obj, NSUInteger count) |
| typedef id(^ | NSAObjectUnaryOperatorWithCount )(id obj, NSUInteger count) |
| typedef BOOL(^ | NSAObjectPickerWithCount )(id obj, NSUInteger count) |
Functions | |
| FOUNDATION_EXTERN void | NSAApply (id< NSFastEnumeration > enumerator, NSAObjectProcedure procedure) |
| Applies mapper to every item of enumerator. More... | |
| FOUNDATION_EXTERN void | NSAApplyWithIndex (id< NSFastEnumeration > enumerator, NSAObjectProcedureWithIndex procedure) |
| Applies mapper with index to every item of enumerator. More... | |
| FOUNDATION_EXTERN NSEnumerator * | NSAMap (id< NSFastEnumeration > enumerator, NSAObjectUnaryOperator mapper) |
| Applies mapper to every item of enumerator and returns an enumerator with every result items. More... | |
| FOUNDATION_EXTERN NSEnumerator * | NSAMapWithIndex (id< NSFastEnumeration > enumerator, NSAObjectUnaryOperatorWithIndex mapper) |
| Applies mapper with index to every item of enumerator and returns an enumerator with every result items. More... | |
| FOUNDATION_EXTERN NSEnumerator * | NSAMapFilter (NSEnumerator *enumerator, NSAObjectUnaryOperator mapper) |
| Applies mapper to every item of enumerator and returns an enumerator with every result items except nil. More... | |
| FOUNDATION_EXTERN NSEnumerator * | NSAMapFilterWithIndex (NSEnumerator *enumerator, NSAObjectUnaryOperatorWithIndex mapper) |
| Applies mapper with index to every item of enumerator and returns an enumerator with every result items except nil. More... | |
| FOUNDATION_EXTERN NSEnumerator * | NSAFilter (NSEnumerator *enumerator, NSAObjectPicker filter) |
| Applies filter to every item of given enumerator and returns an enumerator with the filter result is YES. More... | |
| FOUNDATION_EXTERN NSEnumerator * | NSAFilterWithIndex (NSEnumerator *enumerator, NSAObjectPickerWithIndex filter) |
| Applies filter with index to every item of given enumerator and returns an enumerator with the filter result is YES. More... | |
| FOUNDATION_EXTERN id | NSAReduce (NSEnumerator *enumerator, NSAObjectBinaryOperator operation) |
| Applies operation of two arguments cumulatively to the items of enumerator, from left to right, so as to reduce the iterable to a single value. Uses first and second value as seed. More... | |
| FOUNDATION_EXTERN id | NSAReduceWithInitialObject (id< NSFastEnumeration > enumerator, NSAObjectBinaryOperator operation, id initialObject) |
| Applies operation of two arguments cumulatively to the items of enumerator, from left to right, so as to reduce the iterable to a single value. More... | |
See Map/Filter/Reduce for concept of functional tools.
| typedef id(^ NSAObjectBinaryOperator)(id obj1, id obj2) |
Object binary operation block. Take 2 objects and returns an object.
| typedef BOOL(^ NSAObjectPicker)(id obj) |
Object selection block. Take an object and returns a boolean.
| typedef BOOL(^ NSAObjectPickerWithCount)(id obj, NSUInteger count) |
| typedef BOOL(^ NSAObjectPickerWithIndex)(id obj, NSUInteger index) |
Object selection block. Take an object with index and returns a boolean.
| typedef BOOL(^ NSAObjectPickerWithKey)(id obj, id key) |
Object selection block. Take an object with key and returns a boolean.
| typedef void(^ NSAObjectProcedure)(id obj) |
Procedure take an object. Take an object and execute job.
| typedef void(^ NSAObjectProcedureWithCount)(id obj, NSUInteger count) |
| typedef void(^ NSAObjectProcedureWithIndex)(id obj, NSUInteger index) |
Procedure take an object with index. Take an object and execute job.
| typedef void(^ NSAObjectProcedureWithKey)(id obj, id key) |
Procedure take an object with key. Take an object and execute job.
| typedef id(^ NSAObjectUnaryOperator)(id obj) |
Object unary operation block. Take an object and returns an object.
| typedef id(^ NSAObjectUnaryOperatorWithCount)(id obj, NSUInteger count) |
| typedef id(^ NSAObjectUnaryOperatorWithIndex)(id obj, NSUInteger index) |
Object unary operation block. Take an object with index and returns an object.
| typedef id(^ NSAObjectUnaryOperatorWithKey)(id obj, id key) |
Object unary operation block. Take an object with key and returns an object.
| FOUNDATION_EXTERN void NSAApply | ( | id< NSFastEnumeration > | enumerator, |
| NSAObjectProcedure | procedure | ||
| ) |
Applies mapper to every item of enumerator.
| enumerator | Input object source enumerator. |
| procedure | A procedure to apply every item. |
| FOUNDATION_EXTERN void NSAApplyWithIndex | ( | id< NSFastEnumeration > | enumerator, |
| NSAObjectProcedureWithIndex | procedure | ||
| ) |
Applies mapper with index to every item of enumerator.
| enumerator | Input object source enumerator. |
| procedure | A procedure to apply every item. |
| FOUNDATION_EXTERN NSEnumerator* NSAFilter | ( | NSEnumerator * | enumerator, |
| NSAObjectPicker | filter | ||
| ) |
Applies filter to every item of given enumerator and returns an enumerator with the filter result is YES.
| enumerator | Input object source enumerator. |
| filter | Object filter to decide inclues or not. |
| FOUNDATION_EXTERN NSEnumerator* NSAFilterWithIndex | ( | NSEnumerator * | enumerator, |
| NSAObjectPickerWithIndex | filter | ||
| ) |
Applies filter with index to every item of given enumerator and returns an enumerator with the filter result is YES.
| enumerator | Input object source enumerator. |
| filter | Object filter to decide inclues or not. |
| FOUNDATION_EXTERN NSEnumerator* NSAMap | ( | id< NSFastEnumeration > | enumerator, |
| NSAObjectUnaryOperator | mapper | ||
| ) |
Applies mapper to every item of enumerator and returns an enumerator with every result items.
| enumerator | Input object source enumerator. |
| mapper | Object mapper to apply every item. |
| FOUNDATION_EXTERN NSEnumerator* NSAMapFilter | ( | NSEnumerator * | enumerator, |
| NSAObjectUnaryOperator | mapper | ||
| ) |
Applies mapper to every item of enumerator and returns an enumerator with every result items except nil.
| enumerator | Input object source enumerator. |
| mapper | Object mapper to apply every item. Return nil to pass. |
| FOUNDATION_EXTERN NSEnumerator* NSAMapFilterWithIndex | ( | NSEnumerator * | enumerator, |
| NSAObjectUnaryOperatorWithIndex | mapper | ||
| ) |
Applies mapper with index to every item of enumerator and returns an enumerator with every result items except nil.
| enumerator | Input object source enumerator. |
| mapper | Object mapper to apply every item. Return nil to pass. |
| FOUNDATION_EXTERN NSEnumerator* NSAMapWithIndex | ( | id< NSFastEnumeration > | enumerator, |
| NSAObjectUnaryOperatorWithIndex | mapper | ||
| ) |
Applies mapper with index to every item of enumerator and returns an enumerator with every result items.
| enumerator | Input object source enumerator. |
| mapper | Object mapper to apply every item. |
| FOUNDATION_EXTERN id NSAReduce | ( | NSEnumerator * | enumerator, |
| NSAObjectBinaryOperator | operation | ||
| ) |
Applies operation of two arguments cumulatively to the items of enumerator, from left to right, so as to reduce the iterable to a single value. Uses first and second value as seed.
Given enumerator must enumerate more than a object.
| enumerator | Input object source enumerator. |
| operation | An operator to apply every item and latest result. If it is first object, operation is not used and keep the object as latest result. |
| FOUNDATION_EXTERN id NSAReduceWithInitialObject | ( | id< NSFastEnumeration > | enumerator, |
| NSAObjectBinaryOperator | operation, | ||
| id | initialObject | ||
| ) |
Applies operation of two arguments cumulatively to the items of enumerator, from left to right, so as to reduce the iterable to a single value.
Given enumerator must enumerate more than a object.
| enumerator | Input object source enumerator. |
| operation | An operator to apply every item and latest result. If it is first object, uses initialObject as latest result. |
| initialObject | The initial value to reduce with first element of enumerator. |