https://github.com/artemkalinovsky/Kite
A Swift 6 networking library with async/await, JSON/XML deserialization 🚀, and OAuth2 integration 🔐, supporting iOS/macOS/tvOS/watchOS/visionOS/DriverKit!
https://github.com/artemkalinovsky/Kite
alamofire api api-rest apimanager combine jsonparser networklayer networklibrary swif6 swift swift-framework swiftui xmlparser
Last synced: 4 months ago
JSON representation
A Swift 6 networking library with async/await, JSON/XML deserialization 🚀, and OAuth2 integration 🔐, supporting iOS/macOS/tvOS/watchOS/visionOS/DriverKit!
- Host: GitHub
- URL: https://github.com/artemkalinovsky/Kite
- Owner: artemkalinovsky
- License: mit
- Created: 2020-01-03T16:47:53.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-03T18:46:57.000Z (10 months ago)
- Last Synced: 2025-08-28T08:36:30.926Z (5 months ago)
- Topics: alamofire, api, api-rest, apimanager, combine, jsonparser, networklayer, networklibrary, swif6, swift, swift-framework, swiftui, xmlparser
- Language: Swift
- Homepage:
- Size: 175 KB
- Stars: 43
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://swift.org)
[](https://developer.apple.com/macos/)
[](https://developer.apple.com/ios/)
[](https://developer.apple.com/tvos/)
[](https://developer.apple.com/watchos/)
[](https://developer.apple.com/driverkit/)
[](https://developer.apple.com/visionos/)

# Kite
Kite is named after the kite bird, known for its lightness, speed, and agile flight. This Swift Package aims to embody those qualities—offering a lightweight, fast, and flexible networking layer that soars across Apple platforms.
### Features:
* ***Swift Concurrency (async/await)***: Easily manage asynchronous networking operations.
* Lightweight API Client: A simple APIClient class lets you execute requests that conform to HTTPRequestProtocol or DeserializeableRequest.
* JSON & XML Deserialization: Built-in JSONDeserializer and XMLDeserializer types for decoding server responses.
## Project Status
This project is considered production-ready. Contributions—whether pull requests, questions, or suggestions—are always welcome! 😃
## Installation 📦
* #### Swift Package Manager
You can use Xcode SPM GUI: *File -> Swift Packages -> Add Package Dependency -> Pick "Up to Next Major Version 3.0.0"*.
Or add the following to your `Package.swift` file:
``` swift
.package(url: "https://github.com/artemkalinovsky/Kite.git", from: "3.0.0")
```
Then specify "Kite" as a dependency of the target in which you wish to use Kite.
Here's an example `Package.swift`:
``` swift
// swift-tools-version:6.0
import PackageDescription
let package = Package(
name: "MyPackage",
products: [
.library(
name: "MyPackage",
targets: ["MyPackage"]),
],
dependencies: [
.package(url: "https://github.com/artemkalinovsky/Kite.git", from: "3.0.0")
],
targets: [
.target(
name: "MyPackage",
dependencies: ["Kite"])
]
)
```
## Usage 🧑💻
Let's suppose we want to fetch a list of users from JSON and the response looks like this:
``` json
{
"results":[
{
"name":{
"first":"brad",
"last":"gibson"
},
"email":"brad.gibson@example.com"
}
]
}
```
* #### Setup
1. Create `APIClient` :
``` swift
let apiClient = APIClient()
```
2. Create the Response Model:
``` swift
struct User: Decodable {
struct Name: Decodable {
let first: String
let last: String
}
let name: Name
let email: String
}
```
3. Create a Request with Endpoint Path and Desired Response Deserializer:
``` swift
import Foundation
import Kite
struct FetchRandomUsersRequest: DeserializeableRequestProtocol {
var baseURL: URL { URL(string: "https://randomuser.me")! }
var path: String {"api"}
var deserializer: ResponseDataDeserializer<[User]> {
JSONDeserializer.collectionDeserializer(keyPath: "results")
}
}
```
* #### Perform the Request
``` swift
Task {
let (users, urlResponse) = try await apiClient.execute(request: FetchRandomUsersRequest())
}
```
Voilà!🧑🎨
## Apps using Kite
- [PinPlace](https://apps.apple.com/ua/app/pinplace/id1571349149)
## Credits 👏
* @0111b for [JSONDecoder-Keypath](https://github.com/0111b/JSONDecoder-Keypath)
* @drmohundro for [SWXMLHash](https://github.com/drmohundro/SWXMLHash)
## License 📄
Kite is released under an MIT license. See [LICENCE](https://github.com/artemkalinovsky/Kite/blob/master/LICENSE) for more information.