title: How do you sort an array of structs in swift
body: <p>I have an array of a struct and I would like to be able to sort it by either of the two variables using sort() if possible</p>
  
  <pre><code>struct{
      var deadline = 0
      var priority = 0
  }
  </code></pre>
  
  <p>I looked at sort() in the documentation for the Swift programming language but it shows only simple arrays. can sort() be used or will I have to build my own?</p>