我正在努力通过 this有关在带有 CoreData 的表格 View 单元格上使用手势的教程。
我在 2 个地方遇到了问题,因此大部分内容都已转换。
1.
Swift2:
snapshot.transform = CGAffineTransformMakeScale(1.05, 1.05);
swift 3:
snapshot.transform = CGAffineTransform.scaledBy(1.05, 1.05)
这是我遇到的错误:
Use of instance member 'scaledBy' on type 'CGAffineTransform'; did you mean to use a value of type 'CGAffineTransform' instead?
这是第 2 期。
swift 2:
let bool:Bool = indexPath!.isEqual(beginningIndexPath) as Bool
swift 3:
let bool:Bool = indexPath!.isEqual(beginningIndexPath) as Bool
错误:
Value of type 'IndexPath' has no member 'isEqual'
我尝试使用 == 作为替代,但这也不起作用。
最佳答案
第一期,使用初始化器:
CGAffineTransform(scaleX: 1.05, y: 1.05)
第二期,使用elementsEqual
:
let bool = indexPath!.elementsEqual(beginningIndexPath)
关于ios - 从 Swift 2 转换为 Swift 3 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42958421/