protobuf

Swift 使用 pb 进行数据压缩传递

后端有个已经做的功能需要 iOS 对接使用 pb, 只好找了

https://github.com/apple/swift-protobuf

To translate .proto files into Swift, you will need both Google’s protoc compiler and the SwiftProtobuf code generator plugin.

brew install swift-protobuf

protoc –swift_out=. my.proto

pod ‘SwiftProtobuf’, ‘~> 1.0’

后记

真的踩了很多坑….
Swift 的生态还是没有 OC那么好啊, 个人制作的, 已经明显跟不上其他语言官方版本的开发, 又好多 API 是没有的. 最后使用了官方的 OC 编译版本混编 Swift 来解决问题

期间已经无数次吐槽 Swift 了, 看似在语言上又很好的进步, 说快了多少多少, 但是在开发上, 没有好的生态, 会很痛苦… 浪费很多时间在搜索解决方案上