title: Drawing grid using CAShapeLayer
body: <p>Long story short I want draw a diagonal grid on CALayerShape. My code instead of straight lines produces some kind of curved craziness. It looks very interesting and I wish it would be desired effect, but no, it's not. </p>
  
  <p>My questions:
  1. How can I draw straight lines using CAShapeLayer? 
  2. Did I discover some kind of black hole that affects gravity of pixels in my simulator? </p>
  
  <pre><code>func drawPath(_view:UIView, phase:CGFloat, segment:CGFloat){
          // we need two runs
          var height = CGRectGetHeight(view.frame)
          let width = CGRectGetWidth(view.frame)
  
          let segment:CGFloat = 40
          var currentX:CGFloat = segment
          var cgpath =  CGPathCreateMutable()
  
          for var y = height; y &gt; 0 ; y = y - segment {
  
  
              CGPathMoveToPoint(cgpath, nil, 0, y)
              CGPathAddLineToPoint(cgpath, nil, currentX, 0)
              CGPathCloseSubpath(cgpath)
  
              currentX += segment
          }
  
          var layer = CAShapeLayer()
          layer.path = cgpath
          layer.strokeColor = UIColor.redColor().CGColor
          layer.lineWidth = 1
          layer.fillColor = UIColor.blackColor().CGColor
  
          view.layer.addSublayer(layer)
  
  
      }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/qBAX0.png" alt="distorted grid"></p>