I am getting a json data and appending it to a tuple there are duplicates in this array is there a way i can remove them? here is how am getting the json data and setting it to the tupple
if let hru = ($0["Menu"]["title"]).string{
let uw = ($0["name"]).string
let tagloc = (tag: hru, location: uw)
self.resultTuples.append(tagloc)
}
Am printing the tuple like this
for var i = 0; i < self.resultTuples.count; ++i{
print(self.resultTuples[i])
}
But what gets printed is
tag: Rice Dishes
tag: Rice Dishes
tag: Cakes and Creams
tag: Cakes and Creams
tag: Cakes and Creams
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Pastries and Others
tag: Soups and Sauces
tag: Soups and Sauces
....
I want to remove all the duplicates from this tuple
EDIT:
Using array did not work i have a model Menus
if let hru = ($0["Menu"]["title"]).string{
var men = Menus(nam: hru)
let set = NSSet(array: self.menus)
self.menus = set.allObjects as! [Menus]
self.menus.append(men)
}
for i in self.menus{
print("MENUSS \(i.name)")
}