title: Intersection of CGRect and CGPath
body: <p>Is there an efficient way to detect if a CGPath and a CGRect intersect?</p>
  
  <p>I've thought about looping through every point inside the CGRect sort of like this:</p>
  
  <pre><code>for (CGPoint point in rect) {
     if (CGPathContainsPoint(path, nil, point, NO)) {
        intersects = YES;
        break;
  }
  </code></pre>
  
  <p>But I wanted to know if there was a better way.</p>
  
  <p>In my app there are many CGrects and one CGPath that may change its shape. I just need to check which rects are intersecting with the path, as shown in the image bellow.
  <img src="https://i.stack.imgur.com/xfaqC.png" alt="enter image description here"></p>