Swiftpack.co - danielsaidi/ApiKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by danielsaidi.
danielsaidi/ApiKit 0.7.0
ApiKit is a Swift SDK that helps you integrate with external REST APIs.
⭐️ 43
🕓 7 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/danielsaidi/ApiKit.git", from: "0.7.0")

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. 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.

GitHub

link
Stars: 43
Last commit: 6 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

7 weeks ago

✨ New Features

  • ApiKit now supports visionOS.

💥 Breaking changes

  • SystemNotification now requires Swift 5.9.

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