NSMutableArray(FunkyPrefixedUtilities)
@interface NSMutableArray <ObjectType>
(FunkyPrefixedUtilities) @end
This extension provides simple and easy to use functional and general utilities for NSMutableArray.
All the methods in this category are prefixed with the funky_ keyword for compatibility reasons. If you prefer unprefixed utilities, you should import NSArray+FunkyUtilities.h.
See
Unprefixed counterpartNSMutableArray(FunkyUtilities)
See
Immutable counterpartNSArray(FunkyPrefixedUtilities)
-
Makes the array structure a squence with flat elements, containing no NSArrays
See
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_flattened]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) flatten]Declaration
Objective-C
- (void)funky_flatten;Swift
func funky_flatten()
-
Puts the containing items (in place) in a reversed order.
See
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_reversed]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) reverse]Declaration
Objective-C
- (void)funky_reverse;Swift
func funky_reverse() -
Shuffles the containing items (in place) in a random fashion.
See
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_shuffled]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) shuffle]Declaration
Objective-C
- (void)funky_shuffle;Swift
func funky_shuffle() -
Makes the array unique (in place) by removing the duplicated items from the containing items. The method does this keeping the first occurence and removes the further duplications. It checks equality using the
-isEqual:methodSee
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_unique]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) removeDuplicates]Declaration
Objective-C
- (void)funky_removeDuplicates;Swift
func funky_removeDuplicates()
-
Concatenates the current array (in place) with the one given in the parameter. It does this by putting the existing elements first, and the elements in the provided array afterwards.
See
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_merged:]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) merge:]Declaration
Objective-C
- (void)funky_merge:(NSArray<ObjectType> *)array;Swift
func funky_merge(_ array: [Any]!)Parameters
arrayThe other collection to merge with
-
Sorts the array (in place) using the given comparator.
See
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_sorted:]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) sort:]Declaration
Objective-C
- (void)funky_sort:(NSComparator)comparator;Swift
func funky_sort(_ comparator: Comparator!)Parameters
comparatorAn NSComparator block to define the sort order.
-
Filters the array using the given predicate, keeping the elements that are passing the test.
See
Immutable counterpart-[NSArray(FunkyPrefixedUtilities) funky_filtered:]See
Unprefixed counterpart-[NSMutableArray(FunkyUtilities) filter:]Declaration
Objective-C
- (void)funky_filter:(BOOL (^)(ObjectType))block;Swift
func funky_filter(_ block: ((Any?) -> Bool)!)Parameters
blockThe predicate used to filter the results.
-
Creates a mutable array by repeating the same
itembyrepeatnumber of times. The size of the array is going to be qual torepeat, only consisting ofitemobjects.See
Immutable counterpart+[NSArray(FunkyPrefixedUtilities) funky_arrayWithItem:repeated:]See
Unprefixed counterpart+[NSMutableArray(FunkyUtilities) arrayWithItem:repeated:]Declaration
Objective-C
+ (NSMutableArray<ObjectType> *)funky_arrayWithItem:(id)item repeated:(NSUInteger)repeat;Swift
class func funky_array(withItem item: Any!, repeated repeat: UInt) -> NSMutableArray!Parameters
itemThe item to repeat
repeatNumber of times to repeat the
itemparameterReturn Value
A new NSMutableArray instance with the given item repeated
-
Creates a mutable array by taking an initial
arrayand computing the next items by repeatedly putting the result ofblockbyrepeatednumber of times.See
Immutable counterpart+[NSArray(FunkyPrefixedUtilities) funky_arrayWithArray:nextItem:repeated:]See
Unprefixed counterpart+[NSMutableArray(FunkyUtilities) arrayWithArray:nextItem:repeated:]Declaration
Objective-C
+ (NSMutableArray<ObjectType> *) funky_arrayWithArray:(NSArray<ObjectType> *)array nextItem:(id (^)(NSMutableArray *))block repeated:(NSUInteger)repeat;Swift
class func funky_array(with array: [Any]!, nextItem block: ((NSMutableArray?) -> Any?)!, repeated repeat: UInt) -> NSMutableArray!Parameters
arrayInitial array
blockThe block to compute the next item in the resulting array
repeatNumber of times to repeat calling the
blockparameterReturn Value
A new NSMutableArray instance with items returned by the block
-
Creates a mutable array by taking an initial
arrayand computing the next items by repeatedly putting the result ofblockby until the block parameteruntilreturns YES.See
Immutable counterpart+[NSArray(FunkyPrefixedUtilities) funky_arrayWithArray:nextItem:until:]See
Unprefixed counterpart+[NSMutableArray(FunkyUtilities) arrayWithArray:nextItem:until:]Declaration
Objective-C
+ (NSMutableArray<ObjectType> *) funky_arrayWithArray:(NSArray<ObjectType> *)array nextItem:(id (^)(NSMutableArray *))block until:(BOOL (^)(NSArray *))until;Swift
class func funky_array(with array: [Any]!, nextItem block: ((NSMutableArray?) -> Any?)!, until: (([Any]?) -> Bool)!) -> NSMutableArray!Parameters
arrayInitial array
blockThe block to compute the next item in the resulting array
untilLogic until the iteration should be repeated. Until the block returns YES, the constructor repeatedly callis the
blockparameterReturn Value
A new NSMutableArray instance with items returned by the block
View on GitHub
Install in Dash
NSMutableArray(FunkyPrefixedUtilities) Category Reference