Skip to content

Instantly share code, notes, and snippets.

@alwold

alwold/DispatchTimer.swift

Last active Oct 18, 2017
Embed
What would you like to do?
Dispatch timer
let source = DispatchSource.makeTimerSource()
source.setEventHandler {
NSLog("hello world")
}
source.schedule(deadline: .now(), repeating: .seconds(2))
source.resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment