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 counterpart NSMutableArray(FunkyUtilities)

See

Immutable counterpart NSArray(FunkyPrefixedUtilities)
  • Creates a mutable array by repeating the same item by repeat number of times. The size of the array is going to be qual to repeat, only consisting of item objects.

    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

    item

    The item to repeat

    repeat

    Number of times to repeat the item parameter

    Return Value

    A new NSMutableArray instance with the given item repeated

  • Creates a mutable array by taking an initial array and computing the next items by repeatedly putting the result of block by repeated number of times.

    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

    array

    Initial array

    block

    The block to compute the next item in the resulting array

    repeat

    Number of times to repeat calling the block parameter

    Return Value

    A new NSMutableArray instance with items returned by the block

  • Creates a mutable array by taking an initial array and computing the next items by repeatedly putting the result of block by until the block parameter until returns YES.

    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

    array

    Initial array

    block

    The block to compute the next item in the resulting array

    until

    Logic until the iteration should be repeated. Until the block returns YES, the constructor repeatedly callis the block parameter

    Return Value

    A new NSMutableArray instance with items returned by the block