Protocol Buffers for Obj-C and Apple Swift

Download as .zip Download as .tar.gz View on GitHub

Protocol Buffers for Objective-C

An implementation of Protocol Buffers in Objective C.

Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. This project is based on an implementation of Protocol Buffers from Google. See the Google protobuf project for more information.

How To Install Protobuf

1. ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

2. brew install automake

3. brew install libtool

4. brew instal protobuf

5. ln -s /usr/local/Cellar/protobuf/2.5.0/bin/protoc /usr/local/bin (optional)

6. git clone git@github.com:alexeyxo/protobuf-objc.git

7. ./build.sh

8. Add /src/runtime/ProtocolBuffers.xcodeproj in your project.

Installing from CocoaPods

1...7.

8. cd <your .xcodeproj directory>

9. echo -e "platform :ios , 6.0 \npod 'ProtocolBuffers', '1.9.1' " > Podfile

10. pod install

Compile ".proto" files.

protoc person.proto --objc_out="./"

Example

Web

Server-side requires Ruby(2.0+) and Sinatra gem.

To start ruby sinatra.rb in /Example/Web

if you need to recompile ruby proto models please install ruby_protobuf gem and make rprotoc person.proto

iOS Example

/Example/iOS/Proto.xcodeproj

Project contains protobuf example and small json comparison.

Credits

Maintainer

Booyah Inc.

Google Protocol Buffers, Objective C

Google Protocol Buffers

Download as .zip Download as .tar.gz View on GitHub

Protocol Buffers for Apple Swift

An implementation of Protocol Buffers in Swift.

Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. This project is based on an implementation of Protocol Buffers from Google. See the Google protobuf project for more information.

How To Install Protobuf

1. Download https://protobuf.googlecode.com/svn/rc/protobuf-2.6.0.tar.gz

2. cd protobuf-2.6.0

3. ./configure

4. make

5. sudo make install

6. git clone git@github.com:alexeyxo/protobuf-swift.git

7. ./build.sh

8. Add ./src/runtime-pb-swift/ in your project.

Compile ".proto" files.

protoc person.proto --swift_out="./"

Example

message Person { required int32 id = 1; required string name = 2; optional string email = 3; }

let personBuilder = Person.builder() personBuilder.id = 123 personBuilder.name = "Bob" personBuilder.email = "bob@example.com" let person = personBuilder.build() println("\(person)") person.data() //return [Byte] person.getNSData() //Return NSData

Credits

Developer

Google Protocol Buffers