title: How do sort custom object in an array in swift?
body: <pre><code>class MyClass {
      var name: String?
      var address: String?
  
      init(name: String, address: String){
          self.name = name
          self.address = address
      }
  }
  
  let array = [MyClass(name: "John", address: "USA"), MyClass(name: "Smith", address: "UK"),MyClass(name: "Paul", address: "AUS"), MyClass(name: "Peter", address: "RSA")]
  </code></pre>
  
  <blockquote>
    <p>Now how can sort the array by name of MyClass object.</p>
  </blockquote>