I have a class Person, which has a property firstname. Person objects are then added to an allPeople NSMutableArray in another class:
@interface class1 : NSObject
@property (nonatomic, strong) NSMutableArray *allPeople;
You then have a method inside 'class1' which determines whether the firstname property of a Person object in the array is the same as another firstname property in the array.
This is where I'm stuck, essentially there's only ever going to be five person objects which need to be compared.
What I'd like to do is the following:-
-(BOOL)samefirstname{
//i don't want to tamper with the original allPeople array so i make a mutable copy
NSMutableArray *tempallpeople = [self.allPeople mutableCopy];
for every person object in [tempallpeople]{
if(person1.firstname == person2.firstname || or person1.firstname == person3.firstname || person1.firstname == person4.firstname || or person1.firstname == person5.firstname{
return YES;
}else if (person2.firstname ect ect.
If anybody could shed some light on my issue that would be great.