I have a NSObject defined with a few properties and to keep this question simple, let's say the object is called Vehicle and there are three properties: Manufacturer, Model, Year.
I read all vehicles from a database and the result is a NSMutableArray of Vehicle objects.
I am trying to create a new array of vehicles that are filtered by manufacturer where the object = "Ford".
Is the correct approach:
NSPredicate *fordMotorCarsPredicate = [NSPredicate predicateWithFormat:@"ANY Vehicle.Manufacturer = %@", @"Ford"];
fordMotorCarsArray = [listOfVehicles filteredArrayUsingPredicate:fordMotorCarsPredicate];
I know I could filter the list using an SQL query, but I'd like to know whether this can be achieved in Objective-C code.
Any ideas? Cheers, Ross.