I am trying to iterate over an array and find all the duplicates. I want to populate my TableView with ONE of each of the unique items in the array, and be able to use a segmented controller to sort by the name of the item OR the count of the item...
I want the cell to have labelOne = unique array object, and labelTwo = how many times that object is repeated.
For example
var exampleArr = ["apple", "apple", "apple", "apple", "cat", "cat", "laptop"]
I want to be able to say apple: 4, cat: 2, laptop: 1
My concern is that these answers (from hyperlink) return dictionaries.
Is it possible to create a sortable table view using a dictionary? Or is there a better way to do this