title: Swift Custom NSMutableArray Sorting
body: <p>I have a custom NSMutableArray and i want to sort it; I've looked over the internet but nothing solve my problem. what I have is the following <code>Locations.swift</code></p>
  
  <pre><code>import UIKit
  
  class Location: NSObject {
      var id:String = String()
      var name:String = String()
      var distance:Float = Float()
  }
  </code></pre>
  
  <p>then I create a Mutable Array from this class in my <code>ViewController.swift</code></p>
  
  <pre><code>class CustomViewController: UIViewController{
      var locations: NSMutableArray!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          locations = NSMutableArray()
          locations = SqLite.getInstnace().getLocations()//get values from DB، objects of Location
      }
  
  }
  </code></pre>
  
  <p>how I can sort <code>locations</code> by the <code>distance</code> value??</p>