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

时间:2019-05-23 08:01:19

标签: swift xcode xcode10

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

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

我收到此错误:

  

编译器无法在合理的时间对该表达式进行类型检查;尝试将表达式分成不同的子表达式

1 个答案:

答案 0 :(得分:0)

当迅速的编译器发现表达式太重而无法在合理的时间内计算出该表达式时,就会出现此错误

只要在子表达式中打断您的表达式即可;一个例子可能是:

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