GithubHelp home page GithubHelp logo

rocry / grpc-swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grpc/grpc-swift

0.0 3.0 0.0 5.19 MB

The Swift language implementation of gRPC.

License: Other

Shell 0.06% Makefile 0.01% Swift 4.97% C 83.01% C++ 11.76% Objective-C 0.18% Ruby 0.02%

grpc-swift's Introduction

Build Status

Swift gRPC

This repository contains an experimental Swift gRPC API and code generator.

It is intended for use with Apple's swift-protobuf 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.

The Echo example provides a comprehensive demonstration of currently-supported features.

Swift Package Manager builds may also be made on Linux systems. Please see DOCKER.md and LINUX.md for details.

gRPC dependencies are vendored

Swift gRPC includes vendored copies of the gRPC core library and BoringSSL, an OpenSSL fork that is used by the gRPC Core. These are built automatically in Swift Package Manager builds.

Usage

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.

Getting the dependencies

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

To build the plugins, run make in the Plugin 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-swiftgrpc, which generates gRPC interface code.

Using the plugins

To use the plugins, protoc and both plugins should be in your search path. Invoke them with commands like the following:

protoc <your proto files> \
    --swift_out=. \
    --swiftgrpc_out=.

By convention the --swift_out option invokes the protoc-gen-swift plugin and --swiftgrpc_out invokes protoc-gen-swiftgrpc.

Building your project

Most grpc-swift development is done with the Swift Package Manager. For usage in Xcode projects, we rely on the swift package generate-xcodeproj command to generate an Xcode project for the grpc-swift core libraries.

The top-level Makefile uses the Swift Package Manager to generate an Xcode project for the SwiftGRPC package:

$ make

This will create SwiftGRPC.xcodeproj, which you should add to your project, along with setting build dependencies on BoringSSL, CgRPC, gRPC, and CzLib.

Please also note that your project will need to include the SwiftProtobuf.xcodeproj from Swift Protobuf and the source files that you generated with protoc and the plugins.

Please see Echo for a working Xcode-based example and file issues if you find any problems.

Low-level gRPC

While the recommended way to use gRPC is with Protocol Buffers and generated code, at its core gRPC is a powerful HTTP/2-based communication system that can support arbitrary payloads. As such, each gRPC library includes low-level interfaces that can be used to directly build API clients and servers with no generated code. For an example of this in Swift, please see the Simple example.

Having build problems?

grpc-swift depends on Swift, Xcode, and swift-proto. We are currently testing with the following versions:

  • Xcode 9.1
  • Swift 4.0-dev
  • swift-protobuf 1.0.2

License

grpc-swift is released under the same license as gRPC, repeated in LICENSE.

Contributing

Please get involved! See our guidelines for contributing.

grpc-swift's People

Contributors

acchou avatar bgetsug avatar bootstraponline avatar bretdabaker avatar chemidy avatar deatondg avatar drewsmits avatar gurpartap avatar ishkawa avatar johndpope avatar kyoheig3 avatar mickeyreiss avatar rocry avatar ryanwilson avatar timburks avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.