• Stars
    star
    941
  • Rank 48,574 (Top 1.0 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 3 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web API client built using async/await

Get

Platform

A lean Swift web API client built using async/await.

Get provides a clear and convenient API for modeling network requests using Request<Response> type. And its APIClient makes it easy to execute these requests and decode the responses.

// Create a client
let client = APIClient(baseURL: URL(string: "https://api.github.com"))

// Start sending requests
let user: User = try await client.send(Request(path: "/user")).value

var request = Request(path: "/user/emails", method: .post, body: ["[email protected]"])
try await client.send(request)

The client uses URLSession for networking and provides complete access to all its APIs. It is designed with the "less is more" idea in mind and doesn't introduce any unnecessary abstractions on top of native APIs.

// In addition to `APIClientDelegate`, you can also override any methods
// from `URLSessionDelegate` family of APIs.
let client = APIClient(baseURL: URL(string: "https://api.github.com")) {
    $0.sessionDelegate = ...
}

// You can also provide task-specific delegates and easily change any of
// the `URLRequest` properties before the request is sent.
let delegate: URLSessionDataDelegate = ...
let response = try await client.send(Paths.user.get, delegate: delegate) {
    $0.cachePolicy = .reloadIgnoringLocalCacheData
}

In addition to sending quick requests, it also supports downloading data to a file, uploading from a file, authentication, auto-retries, logging, and more. It's a kind of code that you would typically write on top of URLSession if you were using it directly.

Sponsor πŸ’–

Support Get on GitHub Sponsors.

Documentation

Learn how to use Get by going through the documentation created using DocC.

To learn more about URLSession, see URL Loading System.

Integrations

Pulse

You can easily add logging to your API client using Pulse. It requests a single line to setup.

let client = APIClient(baseURL: URL(string: "https://api.github.com")) {
    $0.sessionDelegate = PulseCore.URLSessionProxyDelegate()
}

With Pulse, you can inspect logs directly on your device – and it supports all Apple platforms. And you can share the logs at any time and view them on a big screen using Pulse Pro.

pulse-preview

CreateAPI

With CreateAPI, you can take your backend OpenAPI spec, and generate all of the response entities and even requests for Get APIClient.

generate api.github.yaml --output ./OctoKit --module "OctoKit"

Check out App Store Connect Swift SDK that uses CreateAPI for code generation.

Other Extensions

Get is a lean framework with a lot of flexibility and customization points. It makes it very easy to learn and use, but you'll need to install additional modules for certain features.

Minimum Requirements

Get Date Swift Xcode Platforms
2.2 Apr 13, 2024 5.8 14.3 iOS 13.0, watchOS 6.0, macOS 10.15, tvOS 13.0, Linux
2.0 Jul 26, 2022 5.5 13.3 iOS 13.0, watchOS 6.0, macOS 10.15, tvOS 13.0, Linux

License

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

More Repositories

1

Nuke

Image loading system
Swift
8,112
star
2

Pulse

Network logger for Apple platforms
Swift
6,307
star
3

DFImageManager

Image loading, processing, caching and preheating
Objective-C
1,180
star
4

Preheat

Automates prefetching of content in UITableView and UICollectionView
Swift
629
star
5

PulsePro

A macOS app for viewing logs from Pulse
Swift
482
star
6

Align

Intuitive and powerful Auto Layout library
Swift
350
star
7

Future

Streamlined Future<Value, Error> implementation
Swift
317
star
8

FetchImage

Makes it easy to download images using Nuke and display them in SwiftUI apps
Swift
212
star
9

Regex

Open source regex engine
Swift
211
star
10

Arranged

Open source replacement of UIStackView for iOS 8 (100% layouts supported)
Swift
208
star
11

VPN

Sample custom VPN client/server in Swift
Swift
182
star
12

Formatting

Swift
179
star
13

DFCache

Composite LRU cache with fast metadata using UNIX extended file attributes
Objective-C
162
star
14

RxNuke

RxSwift extensions for Nuke
Swift
148
star
15

CreateAPI

Delightful code generator for OpenAPI specs
Swift
142
star
16

SwiftSQL

Swift API for SQLite
Swift
131
star
17

ThreeColumnNavigation

A minimal example of three-column navigation for iPad and macOS using SwiftUI
Swift
127
star
18

Stacks

A micro UIStackView convenience API inspired by SwiftUI
Swift
73
star
19

Nuke-FLAnimatedImage-Plugin

FLAnimatedImage plugin for Nuke
Swift
53
star
20

RxUI

Auto-binding for RxSwift inspired by SwiftUI
Swift
45
star
21

Nuke-Alamofire-Plugin

Alamofire plugin for Nuke
Swift
40
star
22

NukeDemo

Nuke Demo
Swift
34
star
23

DFJPEGTurbo

Objective-C libjpeg-turbo wrapper
C
33
star
24

ImagePublisher

Combine publishers for Nuke
Swift
25
star
25

NukeUI

Lazy image loading for Apple platforms: SwiftUI, UIKit, AppKit
Swift
19
star
26

articles

Articles for kean.github.io
19
star
27

URLQueryEncoder

URL query encoder with support for all OpenAPI serialization options
Swift
17
star
28

NukeBuilder

A fun and convenient way to use Nuke
Swift
14
star
29

ScrollViewPrefetcher

Prefetching for SwiftUI
Swift
14
star
30

PulseLogHandler

SwiftLog Extension for Pulse
Swift
12
star
31

HTTPHeaders

Parsing Simple HTTP Headers
Swift
11
star
32

OctoKit

GitHub API client built with Fuse
Swift
8
star
33

PulseApps

Base Pulse macOS and iOS apps and a few demo projects
Swift
7
star
34

kean

1
star