I would like a group element in NSMutableArray like this question: How to implement "group by values" in NSMutableArray?
But, my problem is inside the NSMutableArray i have no values but I have an object of a class model like:
@interface up : NSObject
@property (nonatomic,strong) NSString *id;
@property (nonatomic,strong) NSString *name;
@end
Any ideas?
Example:
Well, practically I have an NSMutableArray and in every cell of this array I have an object of a class model. What I have to do is create a new data structure where I merge objects based on the ID. For example:
{
id = 1;
name = "test";
}
{
id = 1;
name = "test1";
}
{
id = 2;
name = "test2";
}
{
id = 2;
name = "test3";
}
{
id = 3;
name = "test4";
}
Result:
{
id = 1;
name = "test";
name = "test1";
}
{
id = 2;
name = "test2";
name = "test3";
}
{
id = 3;
name = "test4";
}