Prevent adding duplicate item to a NSMutableOrderedSet

456 Views Asked by At

Add new array (addObjectFromArray) to NSMutableOrederedSet, how to check if the NSMutableOrederset already has an existing copy of item/items and no duplication happens?

Code :

 Alamofire.request(.GET, jsonUrl).responseJSON(){
                (_, _, JSON, _) in

    if JSON != nil {

                let imageInfos = (JSON!.valueForKey("image") as [NSDictionary]).map {
                    ImageInfo(id: $0["id"] as String, url: $0["url"] as String)
                }
                self.tableData.addObjectsFromArray(imageInfos)


Same for both viewDidLoad() and handlePullToRefresh()

  • jsonUrl is different for the two methods
0

There are 0 best solutions below