ApiKit
                                
                                 ApiKit copied to clipboard
                                
                                    ApiKit copied to clipboard
                            
                            
                            
                        ApiKit is a Swift SDK that helps you integrate with any REST API.
     
About ApiKit
ApiKit is a Swift SDK that helps you integrate with external REST APIs.
ApiKit has lightweight ApiEnvironment and ApiRoute protocols that make it easy to model any REST-based API. It also has an ApiRequest that can define a route and response type for even easier use.
Once you have an environment and routes, you can use a regular URLSession or a custom ApiClient to fetch any route or request from any environment.
Installation
ApiKit can be installed with the Swift Package Manager:
https://github.com/danielsaidi/ApiKit.git
Getting Started
You can use ApiEnvironments and ApiRoutes to model any API, and create Codable models that automatically map response data from the API.
Once you have created your API-specific types, you can use a plain URLSession or any custom ApiClient to fetch data.
let client = URLSession.shared
let environment = YelpEnvironment.v3(apiToken: "TOKEN") 
let route = YelpRoute.restaurant(id: "abc123") 
let restaurant: YelpRestaurant = try await client.fetchItem(at: route, in: environment)
For more information, please see the getting started guide.
Documentation
The online documentation has more information, articles, code examples, etc.
Demo Application
The demo app lets you explore the library. To try it out, just open and run the Demo project.
Support my work
You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.
Your support makes it possible for me to put more work into these projects and make them the best they can be.
Contact
Feel free to reach out if you have questions or want to contribute in any way:
- Website: danielsaidi.com
- Mastodon: @[email protected]
- Twitter: @danielsaidi
- E-mail: [email protected]
License
ApiKit is available under the MIT license. See the LICENSE file for more info.