我定义了一个名为path的CGMutablePath()和一个名为rect的SKShapeNode():
var path = CGMutablePath()
var path = CGMutablePath()
然后我尝试显示矩形:
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)
但是我得到以下错误:
Nil is not compatible with expected argument type 'UnsafePointer<CGAfineTransform>'
在上一段代码的第二行:
CGPathAddRect(path, nil, rect)
它刚刚开始通过swift 3更新给我这个错误,我该怎么办?