I. Preparation
step 1: protoc installation
Download installation package from the link, 'protoc-3.5.0-osx-x86_64.zip' file is my choise. After unzip the file, moving it to user folder, then set the eviroment variable.
open ~/.bash_profile #open the file
export PATH="$HOME/protobuf/protoc-3.5.0-osx-x86_64/bin:$PATH" # the path for protoc
protoc --help # check whether or not install successfully
to check your environment variables: printenv
step2: protoc-gen-swift installation (protoc's plugin for generating swift code)
The detail step refers to the link. protoc-gen-swift file is in .build/release(hidden in current folder by default, pay attention to this.)
export PATH="$HOME/protobuf/plugins:$PATH" # the path for protoc-gen-swift
protoc-gen-swift --help # check whether or not install successfully
II. Integration SwiftProtobuf
Reference Link:
https://developers.google.com/protocol-buffers/docs/overview