Removing Duplicates From Array of Custom Objects Swift
Here is an Array extension to return the unique list of objects based on a given key: extension Array { func unique<T:Hashable>(map: ((Element) -> (T))) -> [Element] { var set = Set<T>() //the unique list kept in a Set for fast retrieval var arrayOrdered = [Element]() //keeping the unique list of elements but ordered for … Read more