Skip to content

Instantly share code, notes, and snippets.

@andersio
Created May 1, 2017 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersio/33faf2fb9eddefee9bab80c1ea34ccda to your computer and use it in GitHub Desktop.
Save andersio/33faf2fb9eddefee9bab80c1ea34ccda to your computer and use it in GitHub Desktop.
class ManuallyFinishingOperation: BlockOperation {
override var isFinished: Bool {
return _isFinished && super.isFinished
}
var _isFinished: Bool = false {
willSet { willChangeValue(forKey: "isFinished") }
didSet { didChangeValue(forKey: "isFinished") }
}
init(_ block: @escaping (ManuallyFinishingOperation) -> Void) {
super.init()
addExecutionBlock { block(self) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment