Swiftpack.co - hackenbacker/WebClient as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hackenbacker.
hackenbacker/WebClient 0.2.0
Web Client to get data from an API endpoint.
⭐️ 0
🕓 1 week ago
iOS
.package(url: "https://github.com/hackenbacker/WebClient.git", from: "0.2.0")

🕸️ WebClient

Swift Swift Package Manager Platforms

Web Client library to get data from an API endpoint.


Usage

import WebClient

struct Album: Codable {
    var userId: Int
    var id:     Int
    var title:  String
}

do {
    let host = "https://jsonplaceholder.typicode.com/albums"
    let request = URLRequest(url: URL(string: host)!)

    let albums = try await WebClient.fetch([Album].self, for: request)

    for album in albums {
        print(album.title)
    }

} catch {
    print(error)
}

Requirements

  • Xcode 14.2 or later
  • iOS 15.0 or later

Dependencies

  • none

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

0.2.0
1 week ago

Trivial change.

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