问题
I just migrated to swift 3 and i am getting this error ambiguous use of row on indexPath same on section and item.
Other properties are just working like count.
Most probably it is because of inferring.
Here is the ambiguity:
Here is the full log screenshot:
I am using AlecrimCoreData third party and it has the following extension:
// MARK: - IndexPath extensions
extension IndexPath {
public init(forRow row: Int, inSection section: Int) {
self.init(indexes: [section, row])
}
//public var section: Int { return self[0] }
public var row: Int { return self[1] }
}
If I just comment out this line public var row: Int { return self[1] } my code compiles successfully.
回答1:
AlecrimCoreData defines a row property for IndexPath, which conflicts with the existing row property defined in UIKit.
Remove the definition in AlecrimCoreData to solve the problem.
来源:https://stackoverflow.com/questions/40554840/swift-3-ambigous-use-of-row