Kite

3.0.1

A Swift 6 networking library with async/await, JSON/XML deserialization 🚀, and OAuth2 integration 🔐, supporting iOS/macOS/tvOS/watchOS/visionOS/DriverKit!
artemkalinovsky/Kite

What's New

v3.0.1

2025-04-03T18:49:23Z

swift workflow Swift 6 macOS iOS tvOS watchOS driverKit 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:

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

{ 
   "results":[ 
      { 
         "name":{ 
            "first":"brad",
            "last":"gibson"
         },
         "email":"brad.gibson@example.com"
      }
   ]
}
  • Setup

  1. Create APIClient :
    let apiClient = APIClient()
  1. Create the Response Model:
struct User: Decodable {
    struct Name: Decodable {
        let first: String
        let last: String
    }
    
    let name: Name
    let email: String
}
  1. Create a Request with Endpoint Path and Desired Response Deserializer:
import Foundation
import Kite

struct FetchRandomUsersRequest: DeserializeableRequestProtocol {
    var baseURL: URL { URL(string: "https://randomuser.me")! }
    var path: String {"api"}

    var deserializer: ResponseDataDeserializer<[User]> {
        JSONDeserializer<User>.collectionDeserializer(keyPath: "results")
    }
}
  • Perform the Request

Task {
    let (users, urlResponse) = try await apiClient.execute(request: FetchRandomUsersRequest())
}

Voilà!🧑‍🎨

Apps using Kite

Credits 👏

License 📄

Kite is released under an MIT license. See LICENCE for more information.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Sun May 25 2025 19:49:44 GMT-0900 (Hawaii-Aleutian Daylight Time)