title: Adjust CGPath size
body: <p><strong>Introduction</strong></p>
  
  <p>I have a <code>CGPath</code> I create from a <code>SVG</code> file using <code>PocketSVG</code> API. It all works fine.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>The problem is that the shape stretches for some reason, please take a look on this picture (the blue color is just to make is more visible to you, please ignore it, it should be <code>ClearColor</code>):</p>
  
  <p><a href="https://i.stack.imgur.com/uptmC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uptmC.png" alt="Image 1"></a>
  <strong>The Target</strong></p>
  
  <p>What do I want to achieve? I want to achieve a shape that goes all over the screen's width (I don't care about the height, it should modify itself according to the width), and sticks to the bottom of the screen, please take a look on this picture as well (please ignore the circular button):</p>
  
  <p><a href="https://i.stack.imgur.com/n7Lv8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n7Lv8.jpg" alt="Image 2"></a></p>
  
  <p><strong>The Code</strong></p>
  
  <p>The important part ;)</p>
  
  <p>I have a subclass of <code>UIView</code> that draws this shape from the <code>SVG</code> file, it called <code>CategoriesBarView</code>. Then, on my <code>MainViewController</code> (a subclass of <code>UIViewController</code>) I'm creating an object of <code>CategoriesBarView</code> and setting it programmatically as a subview.</p>
  
  <p><em><code>CategoriesBarView</code>:</em></p>
  
  <pre><code>class CategoriesBarView: UIView {
      override func layoutSubviews() {
          let myPath = PocketSVG.pathFromSVGFileNamed("CategoriesBar").takeUnretainedValue()
  
          var transform = CGAffineTransformMakeScale(self.frame.size.width / 750.0, self.frame.size.height / 1334.0)
          let transformedPath = CGPathCreateCopyByTransformingPath(myPath, &amp;transform)
  
          let myShapeLayer = CAShapeLayer()
          myShapeLayer.path = transformedPath
  
          let blur = UIBlurEffect(style: .Light)
          let effectView = UIVisualEffectView(effect: blur)
          effectView.frame.size = self.frame.size
          effectView.frame.origin = CGPointMake(0, 0)
          effectView.layer.mask = myShapeLayer
  
          self.addSubview(effectView)
  
      }
  }
  </code></pre>
  
  <p><em><code>MainViewController</code>:</em></p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      let testHeight = UIScreen.mainScreen().bounds.size.height / 6 // 1/6 of the screen’s height, that is the height in the target picture approximately, doesn’t it?
  
      let categoriesBarView = CategoriesBarView(frame: CGRect(x: 0, y: UIScreen.mainScreen().bounds.size.height - testHeight , width: UIScreen.mainScreen().bounds.size.width, height: testHeight))
          categoriesBarView.backgroundColor = UIColor.blueColor() // AS I said, it should be ClearColor
      self.view.addSubview(categoriesBarView)
  }
  </code></pre>
  
  <p>Does anyone of you know what is the problem here and why the shape is stretching like that? I'll really appreciate if someone could help me here.</p>
  
  <p>Thank you very much :)</p>