NSMutableOrderedSet+BlocksKit.h 1.4 KB

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