I'm trying to remove an object from an Array and I'm using the filter function:
protocol OnLogListener {
func onLog(log: Log)
}
class Logger {
static private var listeners = [OnLogListener]()
static func removeOnLogListener(listener: OnLogListener) {
listeners = listeners.filter({ $0 !== listener })
}
}
The compiler is complaining with the following error:
Cannot invoke 'filter' with an argument list of type '((_) -> _)'
I don't understand the error, the closure is returning a Boolean and using the OnLogListener parameter it is a (OnLogListener) -> Boolean
closure.