在异步NSOperation中覆盖'finished'

时间:2015-08-17 09:51:57

标签: ios swift nsoperation nsoperationqueue

我已经将NSOperation子类化,以执行异步操作。但我不清楚如何声明要完成的操作。我将其覆盖如下,但我似乎应该手动调用willChangeValueForKeydidChangeValueForKey

private var downloadComplete = false

override var finished: Bool {
    get { return self.downloadComplete }
    set {
        willChangeValueForKey("isFinished")
        self.downloadComplete = newValue
        didChangeValueForKey("isFinished")
    }
}

0 个答案:

没有答案