I have an array of dictionaries and I want to sort them alphabetically by the \"itemName\" key in each dictionary. How can I do this in Swift?
I want to sort the ite
I have an array of dictionaries and i am sorting my array with alphabetically by the "firstname" key in each dictionary. You can also sort your array by just putting your array name in this code and your keyName
/*
let descriptor: NSSortDescriptor = NSSortDescriptor(key: "firstname", ascending: true, selector: #selector(NSString.caseInsensitiveCompare(_:)))
let sortedResults: NSArray = yourArrayName.sortedArrayUsingDescriptors([descriptor])
self.user_Array = NSMutableArray(array: sortedResults)
*/
Hopefully it helps you.