NSArray: Remove objects with duplicate properties
I have an NSMutableArray that contains a few custom objects. Two of the objects have the same properties such as title and author. I want to remove the duplicate object and leave the other. Asset *asset; NSMutableArray *items = [[[NSMutableArray alloc] init] autorelease]; // First asset = [[Asset alloc] init]; asset.title = @"Developer"; asset.author = @"John Smith"; [items addObject:asset]; [asset release]; // Second asset = [[Asset alloc] init]; asset.title = @"Writer"; asset.author = @"Steve Johnson"; [items addObject:asset]; [asset release]; // Third asset = [[Asset alloc] init]; asset