ios - “CGPathGetBoundingBox”已被属性 'CGPath.boundingBox' 取代

标签 ios swift cgpath

我正在集成一个用早期 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/

相关文章:

ios - 相机捕获经常使应用崩溃,没有任何线索

ios - Swift - 如何在文本字段外点击后关闭数字键盘

ios - 不能在 UICollectionViewCell 上设置阴影和圆角。一次只能做一件作品

objective-c - 一种跟踪 CAShapeLayer 的 strokeEnd 点的方法?

javascript - 在后台线程中通过 Swift 更新 WKWebView 内容失败

ios - 我希望 collectionview 单元格上有事件指示器,直到从网络服务器加载图像

ios - 未从 UITableViewCell 调用委托(delegate)方法

swift - Metal 内核的不同性能测量

html - 更改Swift NSAttributedString的无序列表的字体

ios - 为什么重复创建和删除SKShapeNode和SKNode会导致内存泄漏?