I'm using a dispatch function to delay the action in my code:
dispatch_after(dispatch_time(
DISPATCH_TIME_NOW,
Int64(10 * Double(NSEC_PER_SEC))
), dispatch_get_main_queue(), { () -> Void in
//het delay thi thuc hien lenh o day
println("test") //or do something after 10 seconds here
})
This function will print a test on my debug area after 10 second of delay. but for example, I want to remove that action before 10 second. How can do that? (i want to add a cancel button for the user if the user press a cancel button, It will remove the action that i setup to do in delay function before)