Skip to content

Instantly share code, notes, and snippets.

@embassem
Created March 14, 2017 11:44
Show Gist options
  • Select an option

  • Save embassem/5340a5ec4662f35d7d73e9abc8a92c0c to your computer and use it in GitHub Desktop.

Select an option

Save embassem/5340a5ec4662f35d7d73e9abc8a92c0c to your computer and use it in GitHub Desktop.
delay swift
//*****************************************************************
// MARK: - Helper Functions
//*****************************************************************
public func delay(_ delay:Double, closure:@escaping ()->()) {
DispatchQueue.main.asyncAfter(
deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: closure)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment