为什么"nil"与"UnsafePointer< CGAffineTransform>"不兼容在Swift 3中? [英] Why is 'nil' not compatible with 'UnsafePointer<CGAffineTransform>' in Swift 3?
问题描述
尝试这样创建CGMutablePath()
:
let path = CGMutablePath()
CGPathMoveToPoint(path, nil, 30, 0)
,但是编译器继续给我以下错误:'nil' not compatible with expected argument type 'UnsafePointer<CGAffineTransform>'
.我究竟做错了什么?我似乎无法在网上找到其他任何东西.
(是的,我尝试过将Ints转换为CGFloats,但似乎没有什么不同.)
but the compiler keeps on giving me the following error: 'nil' not compatible with expected argument type 'UnsafePointer<CGAffineTransform>'
. What am I doing wrong? I can't seem to find anything else online.
(Yes I've tried converting the Ints to CGFloats but it doesn't seem to make a difference.)
推荐答案
尝试一下:
let path = CGMutablePath()
path.move(to: CGPoint(x: 30, y: 0))
CGPath API现在已作为Swift 3中的实例方法导入.
您可以用Command单击CGMutablePath
来检查它们.
或参见 CGMutablePath的最新参考.
CGPath APIs are now imported as instance methods in Swift 3.
You can check them with Command-clicking on CGMutablePath
.
Or see the latest reference of CGMutablePath.
这篇关于为什么"nil"与"UnsafePointer< CGAffineTransform>"不兼容在Swift 3中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!