func sampleWithCompletion(completion:@escaping (()-> ())){
    let delayInSeconds = 1.0
    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delayInSeconds) {
        
        completion()
        
    }
}

//Call the function
sampleWithCompletion {
    print("after one second")
}