Swiftpack.co - Swift Packages by djk12587

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Packages published by djk12587

djk12587/PopNetworking 3.0.7
A protocol-oriented HTTP CRUD networking layer
⭐️ 3
🕓 1 year ago
🔖 Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
PopNetworking 3.0.7
1 year ago
### Whats New in 3.0.7 - Added back support for macOS - updated documentation (https://djk12587.github.io/PopNetworking/documentation/popnetworking) **Full Changelog**: https://github.com/djk12587/PopNetworking/compare/3.0.6...3.0.7
PopNetworking 3.0.6
1 year ago
### Whats New in 3.0.6 - `DecodableResponseWithErrorSerializer` has a new initializer that takes 2 JSONDecoders. 1 to decode the `SuccessType` and a second, to decode the `FailureType` **Full Changelog**: https://github.com/djk12587/PopNetworking/compare/3.0.5...3.0.6
PopNetworking 3.0.5
1 year ago
### Whats New in 3.0.5 - When a [NetworkingRetrier](https://djk12587.github.io/PopNetworking/documentation/popnetworking/networkingrequestretrier) or [Repeater](https://djk12587.github.io/PopNetworking/documentation/popnetworking/networkingroute/repeater-swift.property-9neit) finishes, their respective counters are now reset to 0. **Full Changelog**: https://github.com/djk12587/PopNetworking/compare/3.0.3...3.0.5
PopNetworking 3.0.3
1 year ago
### Whats New in 3.0.3 #### `NetworkingResponseValidator` ```swift public protocol NetworkingResponseValidator { func validate(result: Result<Data, Error>, urlResponse: HTTPURLResponse?) throws } ``` - `NetworkingResponseValidator`'s can be used to validate a response before a `NetworkingResponseSerializer` runs. - Any errors thrown in a `NetworkingResponseValidator` will also be forwarded to the `NetworkingResponseSerializer.serialize` function - A good use case for a `NetworkingResponseValidator` is to capture 500 server errors. ##### example usage ```swift func validate(result: Result<Data, Error>, urlResponse: HTTPURLResponse?) throws { if let statusCode = urlResponse?.statusCode, statusCode == 500 { throw NSError(domain: "Internal server error", code: statusCode) } } ``` ---
PopNetworking 3.0.2
1 year ago
Removed macOS support & Reauthentication Reauthentication can be found [here](https://gist.github.com/djk12587/4d7c099be8f135973d7b287a22ab4fd0)
PopNetworking 3.0.0
1 year ago
### Whats New in 3.0.0 #### `NetworkingRoute` - new optional property for individual `NetworkingRoute` timeout support ```swift public var timeoutInterval: TimeInterval? ``` - `Retrier` was renamed to `Repeater` ```swift public var repeater: Repeater? ``` --- #### `NetworkingResponseSerializer` - The syntax for response serialization has changed ```swift func serialize(result: Result<Data, Error>, urlResponse: HTTPURLResponse?) -> Result<SerializedObject, Error> ``` - `Data` and `Error` are no longer optional and are wrapped within a `Result` type. --- #### `NetworkingSession` - Simplified initializers ```swift public init(urlSession: URLSession = URLSession(configuration: .default), requestAdapter: NetworkingRequestAdapter? = nil, requestRetrier: NetworkingRequestRetrier? = nil) { self.urlSession = urlSession self.requestAdapter = requestAdapter self.requestRetrier = requestRetrier } public init(urlSession: URLSession = URLSession(configuration: .default), requestInterceptor: NetworkingRequestInterceptor? = nil) { self.urlSession = urlSession self.requestAdapter = requestInterceptor self.requestRetrier = requestInterceptor } ``` --- #### `ReauthenticationHandler` - `ReauthenticationHandler` is now a public class - Utilize `ReauthenticationHandler` when you want to wrap your `AccessTokenVerification` into a `NetworkingRequestInterceptor` ```swift // example usage let reauthenticationHandler = ReauthenticationHandler(accessTokenVerifier: yourAccessTokenVerifier()) let networkingSession = NetworkingSession(requestInterceptor: reauthenticationHandler) ``` --- #### Under the hood - Utilizing `URLSession`'s [async await function](https://developer.apple.com/documentation/foundation/urlsession/3919872-data?changes=latest_beta) to execute HTTP requests ```swift func data(for request: URLRequest) async throws -> (Data, URLResponse) ``` - Better async/await support. Utilize `actors`, and improved task cancellation --- **Full Changelog**: https://github.com/djk12587/PopNetworking/pull/18/files/1f1f6ff9281cd53818f1b77845b4dc255d72647c
Consolidated NetworkingSession initializers
1 year ago
There are now only 2 available initializers. ```swift public init(urlSession: URLSessionProtocol = URLSession(configuration: .default), interceptor: Interceptor? = nil, requestAdapter: NetworkingRequestAdapter? = nil, requestRetrier: NetworkingRequestRetrier? = nil, requestIntercepter: NetworkingRequestInterceptor? = nil) ``` and ```swift public convenience init<AccessTokenVerifier: AccessTokenVerification>(urlSession: URLSessionProtocol = URLSession(configuration: .default), interceptor: Interceptor? = nil, requestAdapter: NetworkingRequestAdapter? = nil, requestRetrier: NetworkingRequestRetrier? = nil, requestIntercepter: NetworkingRequestInterceptor? = nil, accessTokenVerifier: AccessTokenVerifier) ```
parameterEncoding defaults to nil
1 year ago
A NetworkingRoute's parameterEncoding property now defaults to nil. **Full Changelog**: https://github.com/djk12587/PopNetworking/compare/2.2.9...2.2.10
Removing currentRequest from RouteDataTasks
1 year ago
In an effort to reduce saving state, a RouteDataTask does not need to hold onto an instance of the currentRequest. This means urlRequests for a route will be recreated for each retry attempt.
URLEncoding no longer appends params to httpBody for GET requests
2 years ago
[2.2.7](https://github.com/djk12587/PopNetworking/tree/2.2.7) caused `get` requests to always add params to the `httpbody` of the `URLRequest`. This is bad practice and results in an error. **Full Changelog**: https://github.com/djk12587/PopNetworking/compare/2.2.7...2.2.8
iOS macOS watchOS tvOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics