/BlocksKit/NSMutableArray+BlocksKit.h

http://github.com/zwaldowski/BlocksKit · C Header · 50 lines · 6 code · 6 blank · 38 comment · 0 complexity · e7554d64a85c44f85f5f22dae22a9b42 MD5 · raw file

  1. //
  2. // NSMutableArray+BlocksKit.h
  3. // %PROJECT
  4. //
  5. #import "BKGlobals.h"
  6. /** Block extensions for NSMutableArray.
  7. These utilities expound upon the BlocksKit additions
  8. to the immutable superclass by allowing certain utilities
  9. to work on an instance of the mutable class, saving memory
  10. by not creating an immutable copy of the results.
  11. Includes code by the following:
  12. - Martin Sch?rrer. <https://github.com/MSch>. 2011. MIT.
  13. - Zach Waldowski. <https://github.com/zwaldowski>. 2011. MIT.
  14. @see NSArray(BlocksKit)
  15. */
  16. @interface NSMutableArray (BlocksKit)
  17. /** Filters a mutable array to the objects matching the block.
  18. @param block A single-argument, BOOL-returning code block.
  19. @see reject:
  20. */
  21. - (void)performSelect:(BKValidationBlock)block;
  22. /** Filters a mutable array to all objects but the ones matching the block,
  23. the logical inverse to select:.
  24. @param block A single-argument, BOOL-returning code block.
  25. @see select:
  26. */
  27. - (void)performReject:(BKValidationBlock)block;
  28. /** Transform the objects in the array to the results of the block.
  29. This is sometimes referred to as a transform, mutating one of each object:
  30. [foo map:^id(id obj) {
  31. return [dateTransformer dateFromString:obj];
  32. }];
  33. @param block A single-argument, object-returning code block.
  34. */
  35. - (void)performMap:(BKTransformBlock)block;
  36. @end