I have app where data after pushing viewcontroller (multiple times) collects in the NSMutableArray
nextController.pathArray = self.pathArray;
How to prevent duplicating data from pathArray in nextController.pathArray?
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.
Create a
NSMutableSetand add your object there as well. Before adding items to your mutable array check first before you add it if it exist in the set. Where ever your adding your data should look something like this example:If you aren’t concern about arrangement for you collection I would suggestion of using a
NSMutableSetinstead ofNSMutableArrayand converting it back to a mutable array when changing view controllers like so: