NSArray(DictionaryUtilities)

@interface NSArray (DictionaryUtilities)

Utilities for arrays of dictionaries.

  • Groups the items in the array by some key, returning a dictionary of those key-grouping pairs.

    Declaration

    Objective-C

    - (nonnull NSDictionary *)groupBy:(nonnull NSString *)key;

    Swift

    func group(by key: String) -> [AnyHashable : Any]