我正在集成一个用早期 Swift
编写的库。由于该库与 Swift 4 的兼容版本不可用,我正在自己删除错误。
有这一行:
let pathBounds = CGPathGetBoundingBox(path.cgPath);
这是给出错误:
'CGPathGetBoundingBox' has been replaced by property 'CGPath.boundingBox'
连同警告:
'CGPathGetBoundingBox' was obsoleted in Swift 3 (CoreGraphics.CGPathGetBoundingBox)
它在 Swift 4 中的替代品是什么? CGPath
类中有一个函数 boundingBox
,但我不知道如何使用它。
最佳答案
很简单:
path.cgPath.boundingBox
关于ios - “CGPathGetBoundingBox”已被属性 'CGPath.boundingBox' 取代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51514960/