我已经将NSOperation子类化,以执行异步操作。但我不清楚如何声明要完成的操作。我将其覆盖如下,但我似乎应该手动调用willChangeValueForKey
和didChangeValueForKey
。
private var downloadComplete = false
override var finished: Bool {
get { return self.downloadComplete }
set {
willChangeValueForKey("isFinished")
self.downloadComplete = newValue
didChangeValueForKey("isFinished")
}
}