Skip to content

Instantly share code, notes, and snippets.

@deda9
Created June 7, 2018 20:41
Show Gist options
  • Save deda9/1ddba83ce6e331274841b0845dc169b0 to your computer and use it in GitHub Desktop.
Save deda9/1ddba83ce6e331274841b0845dc169b0 to your computer and use it in GitHub Desktop.
How to create Custom operation block
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