Created
January 29, 2018 21:27
-
-
Save olbrichj/b86bdf0386745cc81e5279bbe8e9325e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class AsyncOperation: Operation { | |
override var isAsynchronous: Bool { | |
return true | |
} | |
var _isFinished: Bool = false | |
override var isFinished: Bool { | |
set { | |
willChangeValue(forKey: "isFinished") | |
_isFinished = newValue | |
didChangeValue(forKey: "isFinished") | |
} | |
get { | |
return _isFinished | |
} | |
} | |
var _isExecuting: Bool = false | |
override var isExecuting: Bool { | |
set { | |
willChangeValue(forKey: "isExecuting") | |
_isExecuting = newValue | |
didChangeValue(forKey: "isExecuting") | |
} | |
get { | |
return _isExecuting | |
} | |
} | |
func execute() { | |
} | |
override func start() { | |
isExecuting = true | |
execute() | |
isExecuting = false | |
isFinished = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment