2

I am trying to prevent multiple entries of the same value in Core Data. Right now, the entry is just a number (formatted as string). If my database has items 1, 2 , 3, 3, 4, I'd like to remove the second/duplicate entry of 3. While I would like to remove duplicate entries, I am only putting the values in a Table View, so I have tried to run the code below to remove duplicates in the array. However; this did not work.

numberData = results as! [NSManagedObject]
numberData = Array(Set(numberData))
Josh D.
  • 151
  • 1
  • 11
  • 1
    Possible duplicate of [Does there exist within Swift's API an easy way to remove duplicate elements from an array?](http://stackoverflow.com/questions/25738817/does-there-exist-within-swifts-api-an-easy-way-to-remove-duplicate-elements-fro) – NinjaDeveloper Jul 29 '16 at 12:42
  • By "prevent multiple entries of the same value in Core Data", do you mean you are trying to prevent duplicate insertion or fetch? – Kunal Shrivastava Jul 29 '16 at 16:56
  • Tell us about your core data model – Wain Jul 30 '16 at 08:24

0 Answers0