目录
目录README.md

🕸️ 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
关于
35.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号