title: Multi property sort Swift Array
body: <p>I have objects that are in an array I'd like to sort</p>
  
  <pre><code>let person = Person()
  person.isHome = true
  person.firstname = "Foo"
  person.surname = "Bar"
  </code></pre>
  
  <p>etc...</p>
  
  <p>I fetch all the people</p>
  
  <pre><code>guard let allPeople = controller.fetchedObjects as? Array&lt;Person&gt; else { return }
  </code></pre>
  
  <p>Now I'd like to filter and sort</p>
  
  <pre><code>var homeArray = allPeople
          .filter { $0.isHome == true }
          .sort { $0.surname &lt; $1.surname }
  </code></pre>
  
  <p>All fine... except, what if I want extra 'sort descriptors' like this...</p>
  
  <pre><code>var homeArray = allPeople
          .filter { $0.isHome == true }
          .sort { $0.surname &lt; $1.surname }
          .sort { $0.firstname &lt; $1.firstname }
          .sort { $0.isOut == true &amp;&amp; $1.isOut == false }
  </code></pre>
  
  <p>I still want them ordered by surname, but I also want them sorted by first name after surname and injured above non injured... What is the syntax? I can't seem to find it anywhere... Do I have to go back to using NSArray?</p>
  
  <p>Is it as simple as</p>
  
  <pre><code>.sort { ($0.isOut == true &amp;&amp; $1.isOut == false) &amp;&amp; ($0.firstname &lt; $1.firstname) &amp;&amp; ($0.surname &lt; $1.surname)}
  </code></pre>