swift 3 中的 CGpathaddrect

The*_*ect 2 core-graphics swift swift3

我正在转换为 swift 3,但我不确定我所做的是否正确。

旧代码:

CGPathAddRect(innerShadowPath, nil, bubblePath.boundingBoxOfPath.insetBy(dx: -30, dy: -30))
Run Code Online (Sandbox Code Playgroud)

swift 3 的新代码:

innerShadowPath.addPath(bubblePath.boundingBoxOfPath.insetBy(dx: -30, dy: -30) as! CGPath)
Run Code Online (Sandbox Code Playgroud)

非常感谢您的帮助。谢谢。

rma*_*ddy 5

CGPathAddRect应该翻译成addRect, 不是addPath.

innerShadowPath.addRect(bubblePath.boundingBoxOfPath.insetBy(dx: -30, dy: -30))
Run Code Online (Sandbox Code Playgroud)