Swift 3 模糊使用“行" [英] Swift 3 ambigous use of 'row'

查看:20
本文介绍了Swift 3 模糊使用“行"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚迁移到 swift 3 并且我在 sectionitem 上在 indexPath 上不明确地使用 row 时遇到了这个错误.

I just migrated to swift 3 and i am getting this error ambiguous use of row on indexPath same on section and item.

其他属性就像 count 一样工作.

Other properties are just working like count.

很可能是因为推断.

这里有歧义:

这是完整的日志截图:

我正在使用 AlecrimCoreData 第三方,它具有以下扩展名:

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] }

    }

如果我只是注释掉这一行 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.

推荐答案

AlecrimCoreData 为 IndexPath 定义了一个 row 属性,该属性与 UIKit 中定义的现有row 属性.

AlecrimCoreData defines a row property for IndexPath, which conflicts with the existing row property defined in UIKit.

去掉AlecrimCoreData中的定义即可解决问题.

Remove the definition in AlecrimCoreData to solve the problem.

这篇关于Swift 3 模糊使用“行"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆