Issue #197


Install the protoc compiler that is used to generate gRPC service code. The simplest way to do this is to download pre-compiled binaries for your platform( from here:

Unzip this file. Update the environment variable PATH to include the path to the protoc binary file.

Go protoc plugin

go get -u
export PATH=$PATH:$GOPATH/bin
source ~/.zshrc

Swift protoc plugin

The recommended way to use Swift gRPC is to first define an API using the Protocol Buffer language and then use the Protocol Buffer Compiler and the Swift Protobuf and Swift gRPC plugins to generate the necessary support code.

git clone
cd grpc-swift
sudo cp protoc-gen-swift protoc-gen-swiftgrpc /usr/local/bin


protoc --swift_out=MyApp/Api --swiftgrpc_out=Client=true,Server=false:MyApp/Api --go_out=plugins=grpc:server/api api.proto

In case we need to cd

cd MyApp/Library/Models/Proto

protoc --swift_out=../Generated --swiftgrpc_out=Client=true,Server=false:../Generated api.proto


If remote import is needed, then the workaround is to download the that proto locally, for example empty.proto

Inside SwiftProtobuf pod, there is generated empty.pb.swift

public struct Google_Protobuf_Empty {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

To consume, we can

import SwiftProtobuf

let empty = Google_Protobuf_Empty()

oneof mode

message Person {
  oneof mode {
    Human human = 1;
    Superman superman = 2;

Cannot convert value of type ‘Server_Person.OneOf_Mode’ to expected argument type ‘Server_Human’

Need to assign the mode

var person = Person()
person.mode = Person.OneOf_Mode.Human()