沒有輸入引數的完成處理程式
func sampleWithCompletion(completion:@escaping (()-> ())){
let delayInSeconds = 1.0
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delayInSeconds) {
completion()
}
}
//Call the function
sampleWithCompletion {
print("after one second")
}