Swiftpack.co -  grpc/grpc-swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
The Swift language implementation of gRPC.
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.3.0")

Build Status sswg:sandbox|94x20 Latest Version

gRPC Swift

This repository contains a gRPC Swift API and code generator.

It is intended for use with Apple's SwiftProtobuf support for Protocol Buffers. Both projects contain code generation plugins for protoc, Google's Protocol Buffer compiler, and both contain libraries of supporting code that is needed to build and run the generated code.

APIs and generated code is provided for both gRPC clients and servers, and can be built either with Xcode or the Swift Package Manager. Support is provided for all four gRPC API styles (Unary, Server Streaming, Client Streaming, and Bidirectional Streaming) and connections can be made either over secure (TLS) or insecure channels.


gRPC Swift has recently been rewritten on top of SwiftNIO as opposed to the core library provided by the gRPC project.

Version Implementation Branch protoc Plugin CocoaPod Support
1.x SwiftNIO main protoc-gen-grpc-swift gRPC-Swift Actively developed and supported
0.x gRPC C library cgrpc protoc-gen-swiftgrpc SwiftGRPC No longer developed; security fixes only

The remainder of this README refers to the 1.x version of gRPC Swift.

Supported Platforms

gRPC Swift's platform support is identical to the platform support of Swift NIO.

Note that gRPC Swift uses NIO 2 and requires Swift to be version 5.2 or higher.

Getting gRPC Swift

There are two parts to gRPC Swift: the gRPC library and an API code generator.

Getting the gRPC library

Swift Package Manager

The Swift Package Manager is the preferred way to get gRPC Swift. Simply add the package dependency to your Package.swift:

dependencies: [
  .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.0.0")

...and depend on "GRPC" in the necessary targets:

  name: ...,
  dependencies: [.product(name: "GRPC", package: "grpc-swift")]

From Xcode 11 it is possible to add Swift Package dependencies to Xcode projects and link targets to products of those packages; this is the easiest way to integrate gRPC Swift with an existing xcodeproj.

Manual Integration

Alternatively, gRPC Swift can be manually integrated into a project:

  1. Build an Xcode project: swift package generate-xcodeproj,
  2. Add the generated project to your own project, and
  3. Add a build dependency on GRPC.


gRPC Swift is currently available from CocoaPods. To integrate, add the following line to your Podfile:

    pod 'gRPC-Swift', '~> 1.0.0'

Then, run pod install from command line and use your project's generated .xcworkspace file. You might also need to add use_frameworks! to your Podfile.

⚠️ If you have conficting modules as a result of having a transitive dependency on 'gRPC-Core' see grpc/grpc-swift#945.

Getting the protoc Plugins

Binary releases of protoc, the Protocol Buffer Compiler, are available on GitHub.

To build the plugins, run make plugins in the main directory. This uses the Swift Package Manager to build both of the necessary plugins: protoc-gen-swift, which generates Protocol Buffer support code and protoc-gen-grpc-swift, which generates gRPC interface code.

To install these plugins, just copy the two executables (protoc-gen-swift and protoc-gen-grpc-swift) that show up in the main directory into a directory that is part of your PATH environment variable. Alternatively the full path to the plugins can be specified when using protoc.

Alternatively, you can get the latest precompiled version of the plugins by adding the following line to your Podfile:

    pod 'gRPC-Swift-Plugins'

The plugins are available in the Pods/gRPC-Swift-Plugins/ folder afterwards.


gRPC Swift has a number of tutorials and examples available. They are split across two directories:

  • /Sources/Examples contains examples which do not require additional dependencies and may be built using the Swift Package Manager.
  • /Examples contains examples which rely on external dependencies or may not be built by the Swift Package Manager (such as an iOS app).

Some of the examples are accompanied by tutorials, including:

  • A quick start guide for creating and running your first gRPC service.
  • A basic tutorial covering the creation and implementation of a gRPC service using all four call types as well as the code required to setup and run a server and make calls to it using a generated client.
  • An interceptors tutorial covering how to create and use interceptors with gRPC Swift.


The docs directory contains documentation, including:


Please see SECURITY.md.


gRPC Swift is released under the same license as gRPC, repeated in LICENSE.


Please get involved! See our guidelines for contributing.


Stars: 1349
Last commit: 19 hours ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

gRPC Swift 1.3.0
2 weeks ago

SemVer Minor

  • Introduce SwiftProtobufModuleName option to the protoc plugin (#1220, patch credit to @hdv)
  • Add support for Network.framework TLS options (#1221)

SemVer Patch

  • Bump version number to 1.3.0 (#1222)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API