Created
June 7, 2018 20:41
-
-
Save deda9/1ddba83ce6e331274841b0845dc169b0 to your computer and use it in GitHub Desktop.
How to create Custom operation block
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
class CustomOperationBlock: Operation{ | |
private var data: Any! | |
init(_ data: Any){ | |
self.data = data | |
} | |
override func main() { | |
doWork() | |
} | |
private func doWork(){ | |
//Here you can do any work on the data | |
print("Here doing working for \(data!) operation") | |
} | |
} | |
let customOperation = CustomOperationBlock("CustomOperationBlock") | |
customOperation.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment