title: Swift sorted by error: Cannot convert value of type 'CGFloat?' to expected argument type 'Self'
body: <p>This is the custom object:</p>
  <pre><code>struct ScannedFacts {
      var result = -1
      var frame:CGRect? = nil
      var name = &quot;&quot;
  }
  </code></pre>
  <p>and this is the function in which i wanted to sort an array of the below kind:</p>
  <pre><code>func getSortedData(data:[(String, ScannedFacts)]) -&gt; [(String, ScannedFacts)] {
      return data.sorted(by: {$0.1.frame?.minX &lt; $1.1.frame?.minX})
  }
  </code></pre>
  <p>this is the error i get which i really can't figure out:</p>
  <pre><code>Cannot convert value of type 'CGFloat?' to expected argument type 'Self'
  </code></pre>
  <p>what am i missing out here?</p>