Skip to content

Instantly share code, notes, and snippets.

View jgarth's full-sized avatar

Josh Garth jgarth

  • Tiny Empire
  • Dunedin, New Zealand
  • 22:10 (UTC +12:00)
View GitHub Profile
@radex
radex / NSTimer.md
Last active May 30, 2018 10:33
Swift Extensions: NSTimer

NSTimer is a great example of an over-verbose, outdated Objective-C API. To run a simple line of code after a delay, you need to write a lot of boilerplate crap.

How about this:

NSTimer.schedule(5.seconds) {
  println("Hello world!")
}