Grouping of Custom Objects in Objective-C

前端 未结 6 1603
伪装坚强ぢ
伪装坚强ぢ 2021-01-12 03:59

I have and array of custom objects of Person Class

Person : NSObject{
    NSString *firstName;
    NSString *lastName; 
    NSString *age;
}

NSMutableArray          


        
6条回答
  •  离开以前
    2021-01-12 04:57

    There isn't a built in group by method in NSArray. Your example implementation could be added as a category.

    Unfortunately, the @distinctUnionOfObjects operation will only return the strings of the firstName property: John, David. It won't do a group by operation, nor is there such an operation.

    Collection Operations

提交回复
热议问题