@H_
301_0@
听起来很可笑,但我无法修复这段
代码:
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
}