用于 Swift OpenAPI Generator 的 URLSession 传输

一种客户端传输,它使用 Foundation 框架中的 URLSession 类型来执行 HTTP 操作。

将此传输与 Swift OpenAPI Generator 生成的客户端代码一起使用。

支持的平台和最低版本

macOS Linux iOS tvOS watchOS
✅ 10.15+ ✅ 13+ ✅ 13+ ✅ 6+

用法

在你的 Package.swift 文件中添加包依赖项

.package(
    url: "https://github.com/apple/swift-openapi-urlsession",
    .upToNextMinor(from: "0.1.0")
),

请注意,此仓库尚未有 1.0 标签,因此 API 尚不稳定。

接下来,在你的目标中,将 OpenAPIURLSession 添加到你的依赖项

.target(name: "MyTarget", dependencies: [
    .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
],

然后,要开始使用,请查看 URLSessionTransport

报告问题

请在 swift-openapi-generator 仓库中报告与此库相关的任何问题。

文档

要了解更多信息,请查看完整文档