Easy HTTP Networking in Swift a NSURLSession wrapper with image caching support
Xcode 9 and Swift 4 support!
disableErrorLogging
to isErrorLoggingEnabled
URLSessionConfiguration
instead of the custom ConfigurationType
.let networking = Networking(baseURL: "http://httpbin.org", configurationType: .default)
var configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = TimeInterval(60)
configuration.timeoutIntervalForResource = TimeInterval(6048000)
let networking = Networking(baseURL: "http://httpbin.org", configuration: configuration)
Useful for when you don't care about the result but more if there's an error or not.
Before:
networking.delete("/user/10") { result in
switch result {
case .success:
completion(nil)
case .failure(let response):
completion(response.error)
}
}
Now:
networking.delete("/user/10") { result in
completion(result.error) // NSError?
}
After 3 months of 2.0.0 we have refined Networking, refactored the internals, improved the unit tests and now we're ready to delete all the deprecated methods and make the big jump to 3.0.0.
Here are the things that you need to change in order to use Networking 3.
Merged the error and the HTTPURLResponse into one object for each Result case.
After 3 months of 2.0.0 we have refined Networking, refactored the internals, improved the unit tests and now we're ready to delete all the deprecated methods and make the big jump to 3.0.0.
Here are the things that you need to change in order to use Networking 3.
After 3 months of 2.0.0 we have refined Networking, refactored the internals, improved the unit tests and now we're ready to delete all the deprecated methods and make the big jump to 3.0.0.
Here are the things that you need to change in order to use Networking 3.
// Before
networking.GET(....)
networking.POST(....)
networking.PUT(....)
networking.DELETE(....)
// After
networking.get(....)
networking.post(....)
networking.put(....)
networking.delete(....)
let networking = Networking(baseURL: "http://httpbin.org")
networking.disableErrorLogging = true
let networking = Networking(baseURL: "http://httpbin.org")
networking.isSynchronous = true