NSMutableArray *sectionTitles;
[sectionTitles addObject:due];
How do I just add unique values to an array?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See Rudolph’s Answer
My old answer below is now outdated and has been for awhile. Rudoph’s reference to
NSOrderedSet/NSMutableOrderedSetis the correct one since these classes were added after this Q and my A.Old Answer
As Richard said,
NSMutableSetworks well but only if you don’t need to maintain an ordered collection. If you do need an ordered collection a simple content check is the best you can do:Update based on comment
You can wrap this in a method like
-addUniqueObject:and put it in an NSMutableArray category.