swift-atproto

swift-atproto 是一个 atproto 库。

安装

SwiftPM

添加 SwiftAtproto 作为依赖

let package = Package(
    // name, platforms, products, etc.
    dependencies: [
        // other dependencies
        .package(url: "https://github.com/nnabeyang/swift-atproto", from: "0.25.0"),
    ],
    targets: [
        .executableTarget(name: "<executable-target-name>", dependencies: [
            // other dependencies
                .product(name: "SwiftAtproto", package: "swift-atproto"),
        ]),
        // other targets
    ]
)

CocoaPods

将以下内容添加到你的 Podfile

pod 'SwiftAtproto'

用法

代码生成按如下方式完成

swift package plugin --allow-writing-to-package-directory \
--allow-network-connections all:443 swift-atproto --outdir <OUTPUT_DIR> --atproto-configuration ./.atproto.json

示例配置文件如下

{
  "dependencies": [
    {
      "location": "https://github.com/bluesky-social/atproto.git",
      "lexicons": [
        { "prefix": "app.bsky", "path": "lexicons/app/bsky" },
        { "prefix": "com.atproto", "path": "lexicons/com/atproto" },
        { "prefix": "tools/ozone", "path": "lexicons/tools/ozone" }
      ],
      "state": {
        "tag": "@atproto/api@0.13.22"
      }
    },
    {
      "location": "https://github.com/whtwnd/whitewind-blog.git",
      "lexicons": [{ "prefix": "com.whtwnd", "path": "lexicons/com/whtwnd" }],
      "state": {
        "tag": "v1.0.16"
      }
    }
  ],
  "module": "Sources/Lexicon"
}

正在使用的应用

许可

swift-atproto 根据 MIT 许可证发布,请参阅 LICENSE。

作者

Noriaki Watanabe@nnabeyang