CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Levi Bostian.
Quick to configure Moya plugin to handle API responses for mobile app.
When I build mobile apps, this is how I want to handle API network requests:
Was the API request successful (HTTP response status code >=200, <300)?
With all of the mobile apps I build and maintain, I copy/pasted this boilerplate code into each app and edited the code minimally to conform to the app I was building. This boilerplate code was hard to maintain across multiple apps, was a hard API to remember, error prone if I ever messed up a use case, and ugly. Because of this, I built this Moya plugin to allow me to have a quick, flexible, no boilerplate code solution for each of my apps.
MoyaResponseHandler
protocol.class MyMoyaResponseHandler: MoyaResponseHandler {
...
}
MoyaProvider
:MoyaProvider<Target>(plugins: [MoyaResponseHandlerPlugin(handler: MyMoyaResponseHandler)])
MoyaProvider
as usual to call your endpoints.MoyaResponseHandlerPlugin is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MoyaResponseHandlerPlugin"
MoyaResponseHandlerPlugin is available under the MIT license. See the LICENSE file for more info.
Docs for the plugin are located in docs
directory.
The docs are generated via jazzy using command: jazzy --podspec MoyaResponseHandlerPlugin.podspec
(assuming jazzy is intalled. If not: gem install jazzy
)
Photo by Steve Richey on Unsplash