Coding a delay of 1 to 5 seconds during code execution

I am very new to swift. How can I find code to delay during code execution?

NSTimer is the way to go, I think.

`let seconds = 4.0
let delay = seconds * Double(NSEC_PER_SEC)
let dispatchTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))

dispatch_after(dispatchTime, dispatch_get_main_queue(), {

// Returns here after delay

})`

Is the intent really to just pause a number of seconds before executing some code, or is it to wait until something else has finished (e.g. an animation has finished, a download has ended? If the former, @marciokoko’s response is fine; if the latter, a completion handler would be better. (Exactly how that would be expressed would depend on the context, though.)

Very important distinction @narrativium. Kudos!

Thank you Marciokoko, I will try it in playground.

Thank you Narrativium. It is the former.