A Swift port of SebastienThiebaud's dispatch_cancelable_block. https://github.com/SebastienThiebaud/dispatch_cancelable_block
let printBlock = CancelableDispatch.delayBlock(3.0, closure: {
println("I am printed! ๐")
})
let notPrintBlock = CancelableDispatch.delayBlock(3.0, closure: {
println("But... where did I go? ๐ข")
})
CancelableDispatch.cancelDelay(block)
let printBlock = CancelableDispatch.delayBlock(3.0) {
println("I am printed! ๐")
}
let notPrintBlock = CancelableDispatch.delayBlock(3.0) {
println("But... where did I go? ๐ข")
}
CancelableDispatch.cancelDelay(block)