GCD

After amount of time

func delay(delay:Double, closure:()->()) {
    dispatch_after(
        dispatch_time(
            DISPATCH_TIME_NOW,
            Int64(delay * Double(NSEC_PER_SEC))
        ),
        dispatch_get_main_queue(), closure)
}

so use it as:
delay(0.4) {
    // do stuff
}

swift 3

func delay(delay:Double, closure:()->Void) {
  DispatchQueue.main.after(when: DispatchTime.now()+delay, execute: closure)
}

Tags: