加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – 无法使用类型为'((_) – > _)’的参数列表调用

发布时间:2020-12-14 05:34:22 所属栏目:百科 来源:网络整理
导读:听起来很可笑,但我无法修复这段代码: self.runningScripts.filter({ $0 != scriptRunner }) 无论我如何写封闭,我总是得到这个错误: Cannot invoke ‘filter’ with an argument list of type ‘ ((_) - _) ‘ runningScripts定义如下: var runningScripts
听起来很可笑,但我无法修复这段代码:
self.runningScripts.filter({ $0 != scriptRunner })

无论我如何写封闭,我总是得到这个错误:

Cannot invoke ‘filter’ with an argument list of type ‘((_) -> _)

runningScripts定义如下:

var runningScripts = [ScriptRunner]()

ScriptRunner是一个Swift类(不继承NSObject)

我在许多其他地方使用几乎相同的地方没有问题.有什么建议么?

如果没有使ScriptRunner符合Equatable,则可以得到该错误:
class ScriptRunner : Equatable {
    // the rest of your implementation here
}

func ==(lhs: ScriptRunner,rhs: ScriptRunner) -> Bool {
    return ... // change this to whatever test that satisfies that lhs and rhs are equal
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读