I have 2000 contacts and i want to find duplicates and the filter is taking like 1min to find duplicates.
let duplicateArray = contacts.filter { value in
contacts.filter({
$0.phoneNumbers.first?.value.value(forKey: "stringValue") as?
String ?? "" == value.phoneNumbers.first?.value.value(forKey:
"stringValue") as? String ?? ""
}).count > 1
}