升级到 Xcode 10 后出现类型检查错误

type-check error after upgrading to Xcode 10

升级到 Xcode 10 并构建我的代码后

let nearestWedge: Int = Int(round(((currentRadians + (radiansPerWedge / 2)) + snappingPositionRadians) / radiansPerWedge))

我收到这个错误:

The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

当 swift 编译器发现表达式太重而无法在合理的时间内计算时出现此错误

在子表达式中打破你的表达式;一个例子可以是:

let firstHalfOfExpression = (currentRadians + (radiansPerWedge / 2)) + snappingPositionRadians
let nearestWedge: Int = Int(round(firstHalf / radiansPerWedge))