Skip to content

muzicaed/CancelableDispatch_Swift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Cancelable delayed closures in Swift

A Swift port of SebastienThiebaud's dispatch_cancelable_block. https://github.com/SebastienThiebaud/dispatch_cancelable_block

Usages

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)

Usages, if you prefere hanging closuers

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)

Enyoy!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%