Geen omschrijving

George Barnett 0f0d4ccaf7 Generate conformances files containing a message are passed to the plugin (#837) 5 jaren geleden
.github 97be0247fb Update GitHub issue templates (#812) 5 jaren geleden
Examples 1eb00174a4 Bidirectional Streaming iOS Example (#776) 5 jaren geleden
Sources 0f0d4ccaf7 Generate conformances files containing a message are passed to the plugin (#837) 5 jaren geleden
Tests e241e1ddce Ignore additional state changes after expecations have been met (#833) 5 jaren geleden
dev 0f0d4ccaf7 Generate conformances files containing a message are passed to the plugin (#837) 5 jaren geleden
docs 999dba38ad docs: add ProtoPathModuleMappings to the plugin options list (#797) 5 jaren geleden
scripts 977a7b7b93 Update build_podspecs script and re-run (#792) 5 jaren geleden
.gitignore 3109a71355 Provide conformance for messages provided by SwiftProtobuf (#811) 5 jaren geleden
.gitmodules 63c6acfa40 Move CgRPC, gRPC, and QuickProto to "Sources" directory and add new top-level Package.swift. 9 jaren geleden
.travis-install.sh bc51201399 Cache CI dependencies (#827) 5 jaren geleden
.travis-script.sh caaaa5f35e Run tests with TSAN where available, add macOS CI for Swift 5.2 (#799) 5 jaren geleden
.travis.yml f620ac472e Update CI (#832) 5 jaren geleden
AUTHORS 0aa90a79ee Relicense to Apache 2, change owners to "the gRPC Authors". 8 jaren geleden
CGRPCZlib.podspec 977a7b7b93 Update build_podspecs script and re-run (#792) 5 jaren geleden
CODE-OF-CONDUCT.md 5ef0870727 Add/update GOVERNANCE.md, CODE-OF-CONDUCT.md and CONTRIBUTING.md (#595) 6 jaren geleden
CONTRIBUTING.md 5ef0870727 Add/update GOVERNANCE.md, CODE-OF-CONDUCT.md and CONTRIBUTING.md (#595) 6 jaren geleden
GOVERNANCE.md 5ef0870727 Add/update GOVERNANCE.md, CODE-OF-CONDUCT.md and CONTRIBUTING.md (#595) 6 jaren geleden
LICENSE 6dde0518ca Revert to Apache 2.0 license verbatim [skip ci] (#504) 6 jaren geleden
MAINTAINERS.md e0c70ce6f8 Add MAINTAINERS.md. (#564) (#576) 6 jaren geleden
Makefile caaaa5f35e Run tests with TSAN where available, add macOS CI for Swift 5.2 (#799) 5 jaren geleden
PATENTS 36f2bde28e Add PATENTS declaration 9 jaren geleden
Package.resolved 2717d1259c Updated Dependencies (#828) 5 jaren geleden
Package.swift 2717d1259c Updated Dependencies (#828) 5 jaren geleden
README.md c1469e7182 Add high level differences between 1.x and 0.y to README (#814) 5 jaren geleden
gRPC-Swift.podspec 2717d1259c Updated Dependencies (#828) 5 jaren geleden

README.md

Build Status 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.

Versions

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 master protoc-gen-grpc-swift gRPC-Swift Actively developed and supported
0.x gRPC C library cgrpc proroc-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 therefore requires Swift to be version 5.0 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 and depend on "GRPC" in the necessary targets:

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

The syntax for target dependencies changed in Swift 5.2 and requires the package of each dependency to be specified.

For Swift 5.2 (swift-tools-version:5.2):

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

For Swift 5.0 (swift-tools-version:5.0) and 5.1 (swift-tools-version:5.1):

.target(
  name: ...,
  dependencies: ["GRPC"]
)
Xcode

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.

CocoaPods

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

    pod 'gRPC-Swift', '1.0.0-alpha.12'

Then, run pod install from command line and use your project's generated .xcworkspace file.

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.

Examples

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

  • /Sources/Examples contains examples which do not require additional depenedencies 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.

Documentation

The docs directory contains documenation, including:

License

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

Contributing

Please get involved! See our guidelines for contributing.