Open
Description
protoc
$ brew update
$ brew install protobuf --devel --verbose
...
$ protoc --version
libprotoc 3.0.0
protobuf-swift
$ git clone https://github.com/alexeyxo/protobuf-swift
$ git checkout -b ProtoBuf3.0-Swift2.0 origin/ProtoBuf3.0-Swift2.0
$ ./scripts/build.sh
Cocoapods
pod 'ProtocolBuffers-Swift', :git => 'https://github.com/alexeyxo/protobuf-swift', :branch => 'ProtoBuf3.0-Swift2.0'
Error
if named package end with .Protobuf
, the swift
file will has wrong package name.
.proto
file
syntax = "proto3";
package Swift.Protobuf;
.swift
file
// Generated by the Protocol Buffers 3.0 compiler. DO NOT EDIT!
// Source file "api.proto"
// Syntax "Proto3"
import Foundation
import ProtocolBuffers
public struct Swift { public extension Protobuf}
OK
if package named end with other word like Swift.Protobuf1
, it's look good.
.proto
file
syntax = "proto3";
package Swift.Protobuf1;
.swift
file
// Generated by the Protocol Buffers 3.0 compiler. DO NOT EDIT!
// Source file "api.proto"
// Syntax "Proto3"
import Foundation
import ProtocolBuffers
public struct Swift { public extension Protobuf1 { }}