Sort Array of Dictionaries by Key Value
<p>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?</p>

<p>I want to sort the itemsArray.</p>

<pre><code>let array = PFUser.currentUser()?.objectForKey("Collections") as! [[String : AnyObject]]
        let collectionsDictionary = array[0]
        itemsArray = collectionsDictionary[self.title!] as! [[String : AnyObject]]


        for dictionary in itemsArray {
            itemNames.append(dictionary["itemName"] as! String)
            itemUPC.append(dictionary["UPC"] as! String)
            pricePaid.append(dictionary["pricePaid"] as! String)
            currentPrice.append(dictionary["currentPrice"] as! String)
            model.append(dictionary["model"] as! String)
            if (dictionary["image"] != nil) {
                imagesArray.append(dictionary["image"] as! PFFile)
            } else {
                imagesArray.append(nil)
            }
        }
</code></pre>