Swift 3 ambigous use of 'row'

烈酒焚心 提交于 2019-12-23 07:02:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!