Sorting of an array alphabetically in swift
<p>I am new to swift.I am trying one sample app in which I need to implement the sorting of an array in alphabetical order.I getting the json data and I am adding the titles in the array.Now i would like to sort that alphabetically.Here is my code .....</p>

<pre><code>func updateSearchResults(data: NSData?)
{
    do
    {
            let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments)

            if let blogs: NSArray = json["results"] as? [AnyObject] {
                print(blogs)
                for blog in blogs {
                    if let name = blog["original_title"] as? String {
                        names.addObject(name)
                    }
                }
                print(names)
                **let sortedArray = sorted(names, {
                (str1: String, str2: String) -&gt; Bool in
                return str1.toInt() &lt; str2.toInt()** // Here I am getting the Error Message
                })

            }
    }
    catch {
        print("error serializing JSON: \(error)")
    }
}
</code></pre>

<p>The error message I am getting is <strong>"Cannot invoke 'sorted' with an argument list of type '(NSMutableArray, (String, String) -> Bool)'"</strong></p>

<p>I tried a lot to achieve this but I didn't find the solution.
Can anyone help me to resolve this issue.
Thanks In Advance.</p>