I am downloading a file using Alamofire download with progress but i have no idea how to pause / resume / cancel the specific request.
@IBAction func downloadBtn
Keep a reference to the request created in downloadBtnTapped
with a property, and call cancel
on that property in pauseBtnTapped
.
var request: Alamofire.Request?
@IBAction func downloadBtnTapped() {
self.request = Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destination)
}
@IBAction func pauseBtnTapped(sender : UIButton) {
self.request?.cancel()
}