CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Jan 2017 |
| SwiftSwift Version | 3.0 |
| SPMSupports SPM | ✗ |
Maintained by Shagun Madhikarmi, Daniela Dias.
An extension to iOS / macOS Foundation library’s NSURLSession class to add support for cancelling specific URLs from being downloaded.
URLSession+Cancellation.swift file to your Xcode project.See ViewController.swift for sample usage.
There are a couple of methods added to NSURLSession class:
Use the cancelAllRequests function to cancel all pending requests for the session.
session.cancelAllRequests()
Use the cancelRequestForURL function to cancel a request for a specific URL
let url = URL(string: "http://puppygifs.tumblr.com/api/read/json")
session.cancelRequestForURL(url)
Note. the NSURLSession completion handler will be called with an error code NSURLErrorCancelled and domain NSURLErrorDomain.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See the Code of Conduct file.
URLSession+Cancellation is released under the MIT License. See License.