//Version 1, with Dispatch queues.
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
//code to delay
}
//Version 2, with selectors.
@objc func authenticate() {
print("Authentication")
}
perform(#selector(authenticate), with: nil, afterDelay: 1)