title: get distinct elements in an array by object property
body: <p>I have an array of object.
  I want to get distinct elements in this array by comparing objects based on its name property</p>
  
  <pre><code>class Item {
  var name: String
  init(name: String) {
      self.name = name
  }
  }
  let items = [Item(name:"1"), Item(name:"2"), Item(name:"1"), Item(name:"1"),Item(name:"3"), Item(name:"4")]
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>let items = [Item(name:"1"), Item(name:"2"),Item(name:"3"), Item(name:"4")]
  </code></pre>
  
  <p>how can I do this in swift?</p>