登录 注册

swift-protobuf

去点 Star
其他
4,970
Stars
548
Forks
97
Watchers
60
Open Issues
Apache-2.0
许可证
Swift
语言
2016-09-02
创建时间
2026-11-11
最近更新

项目能做什么

在 Swift 中使用 protobuf 的代码生成插件与运行时库。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<img src="https://swift.org/assets/images/swift.svg" alt="Swift logo" height="70" >

# Swift Protobuf

**Welcome to Swift Protobuf!**

[Apple's Swift programming language](https://swift.org/) is a perfect
complement to [Google's Protocol Buffer](https://protobuf.dev/)
("protobuf") serialization technology.
They both emphasize high performance and programmer safety.

This project provides both the command-line program that adds Swift
code generation to Google's `protoc` and the runtime library that is
necessary for using the generated code.
After using the protoc plugin to generate Swift code from your .proto
files, you will need to add this library to your project.

[![Build and Test](https://github.com/apple/swift-protobuf/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apple/swift-protobuf/actions/workflows/build.yml)
[![Check Upstream Protos](https://github.com/apple/swift-protobuf/actions/workflows/check_upstream_protos.yml/badge.svg?branch=main)](https://github.com/apple/swift-protobuf/actions/workflows/check_upstream_protos.yml)
[![Run Protobuf Head Conformance Tests](https://github.com/apple/swift-protobuf/actions/workflows/head_conformance.yml/badge.svg?branch=main)](https://github.com/apple/swift-protobuf/actions/workflows/head_conformance.yml)

# Features of SwiftProtobuf

SwiftProtobuf offers many advantages over alternative serialization
systems:

* Safety: The protobuf code-generation system avoids the
  errors that are common with hand-built serialization code.
* Correctness: SwiftProtobuf passes both its own extensive
  test suite and Google's full conformance test for protobuf
  correctness.
* Schema-driven: Defining your data structures in a separate
  `.proto` schema file clearly documents your communications
  conventions.
* Idiomatic: SwiftProtobuf takes full advantage of the Swift language.
  In particular, all generated types provide full Swift copy-on-write
  value semantics.
* Efficient binary serialization: The `.serializedBytes()`
  method returns a bag of bytes with a compact binary form of your data.
  You can deserialize the data using the `init(contiguousBytes:)`
  initializer.
* Standard JSON serialization: The `.jsonUTF8Bytes()` method returns a JSON
  form of your data that can be parsed with the `init(jsonUTF8Bytes:)`
  initializer.
* Hashable, Equatable: The generated struct can be put into a
  `Set<>` or `Dictionary<>`.
* Performant: The binary and JSON serializers have been
  extensively optimized.
* Extensible: You can add your own Swift extensions to any
  of the generated types.

Best of all, you can take the same `.proto` file and generate
Java, C++, Python, or Objective-C for use on other platforms. The
generated code for those languages will use the exact same
serialization and deserialization conventions as SwiftProtobuf, making
it easy to exchange serialized data in binary or JSON forms, with no
additional effort on your part.

# Documentation

More information is available in th
阅读完整原文

项目深度分析 AI 生成

Proto 调试与可视化桌面工具(macOS/iOS)

产品构想针对使用 SwiftProtobuf 的开发者,打造一款类似 Postman 但专门针对 Protobuf/gRPC 的原生 macOS/iOS 抓包、解析、Mock 与调试工具,能够导入 .proto 文件实时查看二进制解码内容与构造测试请求。
核心功能本地导入 .proto 文件自动构建 UI 表单、二进制 Hex/Base64 与 JSON 双向解析器、内置轻量级 gRPC/HTTP2 调试客户端、网络代理中间人抓包自动解码 Swift 结构体。
目标用户iOS/macOS 客户端开发者、移动端 QA 工程师、全栈独立开发者。
难度/周期中等 · 2-3 个月 · 成本:低(主要为开发机器与 Apple Developer 开发者账号年费)
收费模式独立软件买断制(Mac App Store 售卖,如 $19-$49)或 Freemium 增值订阅(高级功能如团队 Schema 同步需按月付费)。
竞争风险市面上存在通用 gRPC 调试工具(如 BloomRPC、Postman、Proxyman 等具备部分 proto 解码功能),需在原生体验和 Swift/iOS 生态深度定制上突出优势。
依据 AI推测

Proto 转 Swift 架构级脚手架与自动化 SDK 生成器(SaaS / CLI)

产品构想提供将 Proto 定义一键生成企业级 Swift 客户端 SDK 的服务,不仅调用 protoc-gen-swift,还自动包装 Combine/async-await 网络请求层、本地 CoreData/SwiftData 缓存层及自动化 Mock 数据代码。
核心功能CI/CD 集成插件、自动生成符合现代 Swift 并发(async/await)的网络服务代码、数据持久化映射层生成、Breaking Change 语法兼容性破坏预警检测。
目标用户中小型团队工程主管、iOS 技术 Lead、需要维护大量 Proto 接口的移动开发团队。
难度/周期中等 · 1-2 个月 · 成本:低(基础云主机与静态站点)
收费模式按团队席位或私有化部署订阅计费(SaaS 订阅模式),开源基础 CLI,高级模版与企业特性收费。
竞争风险大厂多自研内部工具链,目标客户群体收窄至中小型且重度依赖 gRPC/Proto 的商业团队。
依据 AI推测

Swift 生态 Proto 契约监控与兼容性分析平台

产品构想针对前后端接口演进过程中的兼容性痛点,提供针对 Swift 客户端的 Proto 字段废弃(deprecation)、字段编号碰撞与向后兼容性(Backward Compatibility)静态检查和警报服务。
核心功能Git 集成(GitHub Actions/GitLab CI)、Swift 客户端调用点影响面分析、Proto 规范 Lint 规则集、版本演进安全报告。
目标用户API 平台工程师、移动端基础架构团队、质量保证(QA)团队。
难度/周期高 · 3-4 个月 · 成本:中等(CI 计算资源与云端分析服务开销)
收费模式B2B SaaS 订阅模式,依据代码仓库数量或分析次数阶梯定价。
竞争风险现有通用 Proto 检查工具(如 Buf.build)在生态中壁垒较高,单做 Swift 细分领域天花板较低。
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建于 2016-09-02,近 30 天仍在推送,发布过 71 个 Release
社区活跃Star 4,970 / Fork 548 / Issue 60(数据支持,可自行核实)
许可证Apache-2.0
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。