In iOS, it is an example of handling Protocol Buffers. It is possible to response Protocol Buffers or JSON by requesting one PATH of API server.
Client demo application for iOS.
Using swift-protobuf for protocol buffers. also using RxSwift.
API server of Swift.
In this example using Kitura.
Sample .proto
files.
API server of Go.
First install various packages.
$ cd ./ProtobufClient
$ pod install
$ cd ./ProtobufServer
$ swift build
Create a project file if necessary.
$ swift package generate-xcodeproj
Start up the api or open the project file and run api.
$ ./.build/debug/api
$ go get github.com/golang/protobuf/protoc-gen-go
Start up the api.
$ go run server/api.go
This process is not absolutely necessary.
$ brew install protobuf
Need to create protoc-gen-swift
.
$ cd ./ProtobufServer
$ swift build
$ protoc --plugin=protoc-gen-swift=.build/debug/protoc-gen-swift --swift_out=../protos --proto_path=../protos ../protos/DataModel.proto
$ go get github.com/golang/protobuf/protoc-gen-go
$ cd ./protos
$ protoc --go_out=. DataModel.proto
Generate document using protoc-gen-doc
$ brew install qt5
$ brew link --force qt5
$ git clone https://github.com/estan/protoc-gen-doc.git
$ cd protoc-gen-doc
$ PROTOBUF_PREFIX=/usr/local/Cellar/protobuf/3.1.0 qmake
$ make && make install
Have to match protobuf
version with PROTOBUF_PREFIX
$ cd ./protos
$ protoc --doc_out=markdown,../docs.md:. *.proto
$ cd ./protos
$ protoc --doc_out=html,../index.html:. *.proto
Under the MIT license. See LICENSE file for details.