ApiKit

0.7.0

ApiKit is a Swift SDK that helps you integrate with any REST API.
danielsaidi/ApiKit

What's New

2024-03-06T16:33:47Z

✨ New Features

  • ApiKit now supports visionOS.

💥 Breaking changes

  • SystemNotification now requires Swift 5.9.

ApiKit Logo

Version Swift 5.9 MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

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 on iOS and macOS. 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:

License

ApiKit is available under the MIT license. See the LICENSE file for more info.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Dec 20 2024 07:54:43 GMT-1000 (Hawaii-Aleutian Standard Time)