title: Get the max and min values from an Array of CGPoints
body: <p>We have an array of CGPoints:</p>
  
  <pre><code>let points = [(1234.0, 1053.0), (1241.0, 1111.0), (1152.0, 1043.0)]
  </code></pre>
  
  <p>What I'm  trying to do is get the CGPoint with the highest x value and the one with the highest y value in the array. I will be using these points to create a CGRect:</p>
  
  <pre><code>extension CGRect {
      init(p1: CGPoint, p2: CGPoint) {
          self.init(x: min(p1.x, p2.x),
                    y: min(p1.y, p2.y),
                    width: abs(p1.x - p2.x),
                    height: abs(p1.y - p2.y))
      }
  }
  </code></pre>
  
  <p>I know there a way to get max and min values in an array by doing something like this:</p>
  
  <pre><code>points.min()
  points.max()
  </code></pre>
  
  <p>but these don't seem to work since its an array of CGPoints. Is it possible to get these values from the array?</p>