暫無描述

George Barnett e969195ad2 Make LengthPrefixedMessageReader internal (#674) 6 年之前
.github 0faf1d6e9c Docs/add question template (#310) 7 年之前
Docker ca6831549c Rename the plugin: protoc-gen-swiftgrpc -> protoc-gen-grpc-swift (#584) 6 年之前
Examples 3b6a69e9dd Fix compile issues in Google/NaturalLanguage (#643) 6 年之前
Sources e969195ad2 Make LengthPrefixedMessageReader internal (#674) 6 年之前
Tests e969195ad2 Make LengthPrefixedMessageReader internal (#674) 6 年之前
dev 2737b2570a Remove '###' from git commit template section headers (#509) 6 年之前
docs 5d59407d39 Fix up markdown (#600) 6 年之前
scripts 3b6a69e9dd Fix compile issues in Google/NaturalLanguage (#643) 6 年之前
.gitignore 27dc45142e Build protoc plugins in release mode (#647) 6 年之前
.gitmodules 63c6acfa40 Move CgRPC, gRPC, and QuickProto to "Sources" directory and add new top-level Package.swift. 9 年之前
.travis-install.sh 010b7f9bfe Run CI on Swift 5.1 and Swift 5.0 (#588) 6 年之前
.travis-script.sh a30043ad9c Fix interoperability tests. (#596) 6 年之前
.travis.yml cb929b9b1d Use most recent Swift versions in CI (#670) 6 年之前
AUTHORS 0aa90a79ee Relicense to Apache 2, change owners to "the gRPC Authors". 8 年之前
CODE-OF-CONDUCT.md 5ef0870727 Add/update GOVERNANCE.md, CODE-OF-CONDUCT.md and CONTRIBUTING.md (#595) 6 年之前
CONTRIBUTING.md 5ef0870727 Add/update GOVERNANCE.md, CODE-OF-CONDUCT.md and CONTRIBUTING.md (#595) 6 年之前
DOCKER.md 410ff70c78 update PROTOBUF 7 年之前
GOVERNANCE.md 5ef0870727 Add/update GOVERNANCE.md, CODE-OF-CONDUCT.md and CONTRIBUTING.md (#595) 6 年之前
LICENSE 6dde0518ca Revert to Apache 2.0 license verbatim [skip ci] (#504) 6 年之前
LINUX.md 824814b81d Update Linux build documentation (#346) 7 年之前
MAINTAINERS.md e0c70ce6f8 Add MAINTAINERS.md. (#564) (#576) 6 年之前
Makefile 27dc45142e Build protoc plugins in release mode (#647) 6 年之前
OVERVIEW.md a11da8644e Fix font weight formatting in OVERVIEW.md 8 年之前
PATENTS 36f2bde28e Add PATENTS declaration 9 年之前
Package.resolved 9c0039ef80 Update dependencies (#649) 6 年之前
Package.swift 9c0039ef80 Update dependencies (#649) 6 年之前
README.md 0df475fe2e Add a RouteGuide example and tutorial (#598) 6 年之前
fix-project-settings.rb e5ad11abfb Remove CgRPC implementation (#465) 6 年之前

README.md

Build Status

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 is built on top of Swift NIO as opposed to the core library provided by the gRPC project.

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.6")
]
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

CocoaPods support will be added in v1.0.

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.

Using gRPC Swift

gRPC Swift has a number of tutorials and examples available:

  • 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.

The docs directory contains other 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.