title: CAGradientLayer diagonal gradient
body: <p><a href="https://i.stack.imgur.com/UYqru.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UYqru.png" alt="enter image description here"></a></p>
  
  <p>I use the following CAGradientLayer:</p>
  
  <pre><code>let layer = CAGradientLayer()
  layer.colors = [
      UIColor.redColor().CGColor,
      UIColor.greenColor().CGColor,
      UIColor.blueColor().CGColor
  ]
  layer.startPoint = CGPointMake(0, 1)
  layer.endPoint = CGPointMake(1, 0)
  layer.locations = [0.0, 0.6, 1.0]
  </code></pre>
  
  <p>But when I set bounds property for the layer, it just stretches a square gradient. I need a result like in Sketch 3 app image (see above).</p>
  
  <p>How can I achieve this?</p>