0

I define a CGMutablePath() called path and a SKShapeNode() called rect :

    var path = CGMutablePath()
    var path = CGMutablePath()

Then I try and display the rectangle :

    let rect = CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height/2-36)
    CGPathAddRect(path, nil, rect)
    shapeNode.path = path
    shapeNode.lineWidth = 0
    shapeNode.fillColor = SKColor.black
    shapeNode.zPosition = 1
    self.addChild(shapeNode)

But I then get the following error :

     Nil is not compatible with expected argument type 'UnsafePointer<CGAfineTransform>'

At the second line of the previous code :

    CGPathAddRect(path, nil, rect)

It has only started giving me this error with the swift 3 update, what do I do?

Oliver Redeyoff
  • 177
  • 2
  • 14
  • 2
    See [Why is 'nil' not compatible with 'UnsafePointer' in Swift 3?](http://stackoverflow.com/q/39041888/2976878) (dupe, given that one answer shows the use of `addRect`?) – Hamish Jan 04 '17 at 17:28
  • 1
    Another one here: http://stackoverflow.com/questions/39508387/1-cgpathmovetopoint-is-unavailable-use-movetotransform-2-cgpathaddlinet. – Martin R Jan 04 '17 at 17:30
  • Thanks I don't know how I managed to miss those questions when I looked it up... – Oliver Redeyoff Jan 04 '17 at 17:31

0 Answers0