{"id":1675,"url":"https://github.com/alexeyxo/protobuf-swift","last_synced_at":"2025-05-15T20:03:29.048Z","repository":{"id":18032275,"uuid":"21071034","full_name":"alexeyxo/protobuf-swift","owner":"alexeyxo","description":"Google ProtocolBuffers for Apple Swift","archived":false,"fork":false,"pushed_at":"2024-04-28T06:44:58.000Z","size":27153,"stargazers_count":941,"open_issues_count":30,"forks_count":137,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-05-07T22:35:11.866Z","etag":null,"topics":["carthage","ios","macos","networking","protobuf","protobuf-compiler","protobuf-swift","protoc","protocol-buffers","swift"],"latest_commit_sha":null,"homepage":"http://protobuf.io/#swift","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexeyxo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-21T14:56:48.000Z","updated_at":"2025-04-27T10:00:29.000Z","dependencies_parsed_at":"2024-06-18T12:42:43.080Z","dependency_job_id":"878ccd54-c838-424d-90b5-7402bdc054cb","html_url":"https://github.com/alexeyxo/protobuf-swift","commit_stats":{"total_commits":307,"total_committers":20,"mean_commits":15.35,"dds":"0.30293159609120524","last_synced_commit":"f396f02cff0781db3857056b96adc424fb336b96"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexeyxo%2Fprotobuf-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexeyxo%2Fprotobuf-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexeyxo%2Fprotobuf-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexeyxo%2Fprotobuf-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexeyxo","download_url":"https://codeload.github.com/alexeyxo/protobuf-swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948418,"owners_count":21988954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carthage","ios","macos","networking","protobuf","protobuf-compiler","protobuf-swift","protoc","protocol-buffers","swift"],"created_at":"2024-01-05T20:15:53.029Z","updated_at":"2025-05-15T20:03:27.814Z","avatar_url":"https://github.com/alexeyxo.png","language":"Swift","funding_links":[],"categories":["Representations","Libs","Swift","Networking","Google ProtocolBuffers repos","Utility [🔝](#readme)","Network"],"sub_categories":["Email","Utility","Other free courses"],"readme":"# Protocol Buffers for Swift\n\n[![Build Status](https://travis-ci.org/alexeyxo/protobuf-swift.svg?branch=master)](https://travis-ci.org/alexeyxo/protobuf-swift) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage) [![Version](http://img.shields.io/cocoapods/v/ProtocolBuffers-Swift.svg?style=flat-square)](http://cocoapods.org/?q=ProtocolBuffers-Swift) [![Platform](https://img.shields.io/badge/platform-ios%7Cmacos%7Ctvos%7Cwatchos%7Clinux-brightgreen.svg?style=flat-square)](http://cocoapods.org/?q=ProtocolBuffers)\n\nAn implementation of Protocol Buffers in Swift.\n\nProtocol 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](https://developers.google.com/protocol-buffers/docs/overview) for more information.\n\n#### Required Protocol Buffers 3.0\n\n## How To Install Protobuf Compiler on Linux(Ubuntu 14.04)\n\n1.`wget https://github.com/google/protobuf/archive/v3.2.0.tar.gz`\n\n2.`tar xzf v3.2.0.tar.gz`\n\n3.`cd protobuf-3.2.0/`\n\n4.`sudo apt-get install autoreconf automake libtool make`\n\n5.`./autogen.sh`\n\n6.`./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib`\n\n7.`sudo make \u0026\u0026 sudo make install`\n\n8.`cd .. \u0026\u0026 wget https://github.com/alexeyxo/protobuf-swift/archive/3.0.9.tar.gz \u0026\u0026 tar xzf 3.0.9.tar.gz \u0026\u0026 cd protobuf-swift-3.0.9`\n\n9.`./script/build.sh \u0026\u0026 swift build`\n \n## How To Install Protobuf Compiler from Homebrew\n\n1.`ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"`\n\n2.`brew install protobuf-swift`\n\n## How To Install Protobuf Compiler\n\n1.`ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"`\n\n2.`brew install automake`\n\n3.`brew install libtool`\n\n4.`brew install protobuf`\n\n5.`git clone git@github.com:alexeyxo/protobuf-swift.git`\n\n6.`./scripts/build.sh`\n\nAdd `./src/ProtocolBuffers/ProtocolBuffers.xcodeproj` in your project.\n\n## Cocoapods\n\nPodfile:\n\n```pod\nuse_frameworks!\npod 'ProtocolBuffers-Swift'\n```\n\n## \u003cimg src=\"https://cloud.githubusercontent.com/assets/432536/5252404/443d64f4-7952-11e4-9d26-fc5cc664cb61.png\" width=\"22\" height=\"22\"\u003e Installation via [Carthage](https://github.com/Carthage/Carthage)\n\nCartfile:\n\n```\ngithub \"alexeyxo/protobuf-swift\"\n```\n\n## Compile \".proto\" files.\n\n```sh\nprotoc  person.proto --swift_out=\"./\"\n```\n\n## Serializing\n\n```protobuf\nsyntax = \"proto2\";\nmessage Person {\n    required int32 id = 1;\n    required string name = 2;\n    optional string email = 3;\n}\n```\n\n```swift\nlet personBuilder = Person.Builder()\npersonBuilder.id = 123\npersonBuilder.name = \"Bob\"\npersonBuilder.email = \"bob@example.com\"\nlet person = try! personBuilder.build()\nprint(person)\n\nperson.data() //return NSData\n```\n\n## Chaining\n\n```protobuf\nsyntax = \"proto2\";\nmessage Perfomance\n{\n  required int32 ints = 1;\n  required int64 ints64 = 2;\n  required double doubles = 3;\n  required float floats  = 4;\n  optional string str  = 5;\n  optional bytes bytes  = 6;\n  optional string description = 7;\n}\n```\n\n```swift\nvar originalBuilder = ProtoPerfomance.Builder()\noriginalBuilder.setInts(Int32(32))\n               .setInts64(Int64(64))\n               .setDoubles(Double(12.12))\n               .setFloats(Float(123.123))\n               .setStr(\"string\")\nlet original = originalBuilder.build()\n```\n\n## Sub Builders\n\n```protobuf\nsyntax = \"proto2\";\nmessage Foo {\n  optional int32 val = 1;\n  // some other fields.\n}\n\nmessage Bar {\n  optional Foo foo = 1;\n  // some other fields.\n}\n\nmessage Baz {\n  optional Bar bar = 1;\n  // some other fields.\n}\n```\n\n```swift\nvar builder = baz.toBuilder()\nbuilder.getBarBuilder().getFooBuilder().setVal(10)\nbaz = builder.build()\n```\n\n## Maps(ProtocolBuffers 3.0)\n```protobuf\nsyntax = \"proto3\";\nmessage MapMessageValue\n{\n    int32 valueInMapMessage = 1;\n}\n\nmessage MessageContainsMap\n{\n\n  enum EnumMapValue\n  {\n    FirstValueEnum = 0;\n    SecondValueEnum = 1;\n  }\n\n  map\u003cint32,int32\u003e map_int32_int32= 1;\n  map\u003cint64,int64\u003e map_int64_int64= 2;\n  map\u003cstring,string\u003e map_string_string = 3;\n  map\u003cstring,bytes\u003e map_string_bytes = 4;\n  map\u003cstring,MapMessageValue\u003e map_string_message = 5;\n  map\u003cint32,EnumMapValue\u003e map_int32_enum = 6;\n\n}\n```\n\n```swift\nfinal internal class MessageContainsMap : GeneratedMessage, GeneratedMessageProtocol, Hashable {\n    ...\n    private(set) var mapInt32Int32:Dictionary\u003cInt32,Int32\u003e = Dictionary\u003cInt32,Int32\u003e()\n    private(set) var mapInt64Int64:Dictionary\u003cInt64,Int64\u003e = Dictionary\u003cInt64,Int64\u003e()\n\n    private(set) var mapStringString:Dictionary\u003cString,String\u003e = Dictionary\u003cString,String\u003e()\n    private(set) var mapStringBytes:Dictionary\u003cString,NSData\u003e = Dictionary\u003cString,NSData\u003e()\n    private(set) var mapInt32Enum:Dictionary\u003cInt32,MessageContainsMap.EnumMapValue\u003e = Dictionary\u003cInt32,MessageContainsMap.EnumMapValue\u003e()\n    ...\n}\n```\n\n## JSON(proto3)\n```swift\nlet personBuilder = Person.builder()\npersonBuilder.id = 123\npersonBuilder.name = \"Bob\"\npersonBuilder.email = \"bob@example.com\"\nlet person = personBuilder.build()\nlet jsonData = person.toJSON() //return NSData\nlet jsonDictionaryObject:Dictionary\u003cString,AnyObject\u003e = person.encode()\nlet personFromJson = Person.fromJSON(jsonData) //Person\n```\n\n## Deserializing\n\n```swift\nvar person = Person.parseFromData(bytes) // from NSData\n```\n\n## Using Oneof\n\n```protobuf\nsyntax = \"proto3\";\nmessage SubMessage {\n    string str = 1;\n}\n\nmessage SampleMessage {\n  oneof test_oneof {\n     string name = 4;\n     int32 id = 5;\n     SubMessage mes = 6;\n  }\n}\n```\n\n```swift\nvar sm = SampleMessage.Builder()\nsm.name = \"Alex\"\nsm.id = 123\nprintln(ss.build()) //-\u003e  id: 123\n```\n\n## Nested Types\n\n```protobuf\nsyntax = \"proto3\";\nmessage SearchResponse {\n    message Result {\n        string url = 1;\n        string title = 2;\n        repeated string snippets = 3;\n    }\n    repeated Result result = 1;\n}\n```\n\n```swift\nvar builderResult = SearchResponse.Result.Builder()\nbuilderResult.url = \"http://protobuf.axo.io\"\nbuilderResult.title = \"Protocol Bufers Apple Swift\"\nvar searchRespons = SearchResponse.builder()\nsearchRespons.result += [builderResult.build()]\nprintln(searchRespons.build())\n```\n\n## Packages\n\n```protobuf\nsyntax = \"proto2\";\npackage FooBar;\nmessage Perfomance\n{\n  required int32 ints = 1;\n  required int64 ints64 = 2;\n  required double doubles = 3;\n  required float floats  = 4;\n  optional string str  = 5;\n  optional bytes bytes  = 6;\n  optional string description = 7;\n}\n```\n\n```swift\npublic extension FooBar {\n  ...\n  final public class Perfomance : GeneratedMessage, GeneratedMessageProtocol {\n    ...\n  }\n\n}\n```\n\n## Custom Options\n\n```protobuf\nimport \"google/protobuf/descriptor.proto\";\n\npackage google.protobuf;\n\nenum AccessControl {\n  InternalEntities = 0;\n  PublicEntities = 1;\n}\nmessage SwiftFileOptions {\n\n  optional string class_prefix = 1;\n  optional AccessControl entities_access_control = 2 [default = PublicEntities];\n  optional bool compile_for_framework = 3 [default = true];\n}\n\nmessage SwiftMessageOptions {\n  optional bool generate_error_type = 1 [default = false];\n}\n\nmessage SwiftEnumOptions {\n  optional bool generate_error_type = 1 [default = false];\n}\n\nextend google.protobuf.FileOptions {\n  optional SwiftFileOptions swift_file_options = 5092014;\n}\n\nextend google.protobuf.MessageOptions {\n  optional SwiftMessageOptions swift_message_options = 5092014;\n}\n\nextend google.protobuf.EnumOptions {\n  optional SwiftEnumOptions swift_enum_options = 5092015;\n}\n\noption (.google.protobuf.swift_file_options).compile_for_framework = false;\noption (.google.protobuf.swift_file_options).entities_access_control = PublicEntities;\n```\n\nAt now protobuf-swift's compiler is supporting custom options.\n\n1.\tClass Prefix\n2.\tAccess Control\n3.  Error Types \n4.\tCompile for framework\n\nIf you have use custom options, you need to add:\n\n```protobuf\nimport 'google/protobuf/swift-descriptor.proto';\n```\n\nin your `.proto` files.\n\n### Class prefix\n\nThis option needs to generate class names with prefix.\n\nExample:\n\n```protobuf\nimport 'google/protobuf/swift-descriptor.proto';\n\noption (.google.protobuf.swift_file_options).class_prefix = \"Proto\";\n\nmessage NameWithPrefix\n{\n  optional string str = 1;\n}\n```\n\nGenerated class has a name:\n\n```swift\nfinal internal class ProtoNameWithPrefix : GeneratedMessage\n```\n\n### Access control\n\n```protobuf\noption (.google.protobuf.swift_file_options).entities_access_control = PublicEntities;\n```\n\nAll generated classes marks as `internal` by default. If you want mark as `public`, you can use `entities_access_control` option.\n\n```protobuf\noption (.google.protobuf.swift_file_options).entities_access_control = PublicEntities;\n\nmessage MessageWithCustomOption\n{\n  optional string str = 1;\n}\n```\n\nGenerated class and all fields are marked a `public`:\n\n```swift\nfinal public class MessageWithCustomOption : GeneratedMessage\n```\n\n### Generate enum/message conforming to \"Error\" protocol\n\n```protobuf\noption (.google.protobuf.swift_enum_options).generate_error_type = true;\n```\n\n#### Example\n\n```protobuf\n\nimport 'google/protobuf/swift-descriptor.proto';\n\nenum ServiceError {\n  option (.google.protobuf.swift_enum_options).generate_error_type = true;\n  BadRequest = 0;\n  InternalServerError = 1;\n}\n\nmessage UserProfile {\n    message Request {\n        required string userId = 1;\n    }\n    message Response {\n        optional UserProfile profile = 1;\n        optional ServiceError error = 2;\n        optional Exception exception = 3;\n    }\n\n     message Exception {\n        option (.google.protobuf.swift_message_options).generate_error_type = true;\n        required int32 errorCode = 1;\n        required string errorDescription = 2;\n    }\n    \n    optional string firstName = 1;\n    optional string lastName = 2;\n    optional string avatarUrl = 3;\n}\n```\n\n```swift\npublic enum ServiceError:Error, RawRepresentable, CustomDebugStringConvertible, CustomStringConvertible {\n  public typealias RawValue = Int32\n\n  case badRequest\n  case internalServerError\n\n  public init?(rawValue: RawValue) {\n    switch rawValue {\n    case 0: self = .badRequest\n    case 1: self = .internalServerError\n    default: return nil\n    }\n  }\n\n  public var rawValue: RawValue {\n    switch self {\n    case .badRequest: return 0\n    case .internalServerError: return 1\n    }\n  }\n\n  public func throwException() throws {\n    throw self\n  }\n\n  public var debugDescription:String { return getDescription() }\n  public var description:String { return getDescription() }\n  private func getDescription() -\u003e String { \n    switch self {\n    case .badRequest: return \".badRequest\"\n    case .internalServerError: return \".internalServerError\"\n    }\n  }\n}\n```\n```swift\nfunc generateException()throws {\n    let user = UserProfile.Response.Builder()\n    user.error = .internalServerError\n    let data = try user.build().data()\n    let userError = try UserProfile.Response.parseFrom(data:data)\n    if userError.hasError {\n        throw userError.error //userError.error.throwException()\n    }\n}\n\ndo {\n    try generateException()\n} catch let err as ServiceError where err == .internalServerError {\n    XCTAssertTrue(true)\n} catch {\n    XCTAssertTrue(false)\n}\n\nfunc throwExceptionMessage() throws {\n  let exception = UserProfile.Exception.Builder()\n  exception.errorCode = 403\n  exception.errorDescription = \"Bad Request\"\n  let exc = try exception.build()\n  let data = try UserProfile.Response.Builder().setException(exc).build().data()\n  let userError = try UserProfile.Response.parseFrom(data:data)\n  if userError.hasException {\n      throw userError.exception\n  }\n}\n\ndo {\n    try throwExceptionMessage()\n} catch let err as UserProfile.Exception {\n    print(err)\n    XCTAssertTrue(true)\n} catch {\n    XCTAssertTrue(false)\n}\n  \n```\n\n### Compile for framework\n\n```protobuf\noption (.google.protobuf.swift_file_options).compile_for_framework = false;\n```\n\nThis option deletes the string `import ProtocolBuffers` of the generated files.\n\n#### If you will need some other options, write me. I will add them.\n\n\n\n\n## Utilities (ProtocolBuffers 3.0)\n\nAdded well-known type protos (any.proto, empty.proto, timestamp.proto, duration.proto, etc.). Users can import and use these protos just like regular proto files. Addtional runtime support will be added for them in future releases (in the form of utility helper functions, or having them replaced by language specific types in generated code).\n#### Any\n```protobuf\nmessage Any {\n  // A URL/resource name whose content describes the type of the\n  // serialized message.\n  //\n  // For URLs which use the schema `http`, `https`, or no schema, the\n  // following restrictions and interpretations apply:\n  //\n  // * If no schema is provided, `https` is assumed.\n  // * The last segment of the URL's path must represent the fully\n  //   qualified name of the type (as in `path/google.protobuf.Duration`).\n  // * An HTTP GET on the URL must yield a [google.protobuf.Type][google.protobuf.Type]\n  //   value in binary format, or produce an error.\n  // * Applications are allowed to cache lookup results based on the\n  //   URL, or have them precompiled into a binary to avoid any\n  //   lookup. Therefore, binary compatibility needs to be preserved\n  //   on changes to types. (Use versioned type names to manage\n  //   breaking changes.)\n  //\n  // Schemas other than `http`, `https` (or the empty schema) might be\n  // used with implementation specific semantics.\n  //\n  // Types originating from the `google.*` package\n  // namespace should use `type.googleapis.com/full.type.name` (without\n  // schema and path). A type service will eventually become available which\n  // serves those URLs (projected Q2/15).\n  string type_url = 1;\n\n  // Must be valid serialized data of the above specified type.\n  bytes value = 2;\n}\n```\n```swift\nGoogle.Protobuf.Any()\n```\n\n#### API\n```protobuf\nmessage Api {\n  // The fully qualified name of this api, including package name\n  // followed by the api's simple name.\n  string name = 1;\n\n  // The methods of this api, in unspecified order.\n  repeated Method methods = 2;\n\n  // Any metadata attached to the API.\n  repeated Option options = 3;\n\n  // A version string for this api. If specified, must have the form\n  // `major-version.minor-version`, as in `1.10`. If the minor version\n  // is omitted, it defaults to zero. If the entire version field is\n  // empty, the major version is derived from the package name, as\n  // outlined below. If the field is not empty, the version in the\n  // package name will be verified to be consistent with what is\n  // provided here.\n  //\n  // The versioning schema uses [semantic\n  // versioning](http://semver.org) where the major version number\n  // indicates a breaking change and the minor version an additive,\n  // non-breaking change. Both version numbers are signals to users\n  // what to expect from different versions, and should be carefully\n  // chosen based on the product plan.\n  //\n  // The major version is also reflected in the package name of the\n  // API, which must end in `v\u003cmajor-version\u003e`, as in\n  // `google.feature.v1`. For major versions 0 and 1, the suffix can\n  // be omitted. Zero major versions must only be used for\n  // experimental, none-GA apis.\n  //\n  // See also: [design doc](http://go/api-versioning).\n  //\n  //\n  string version = 4;\n\n  // Source context for the protocol buffer service represented by this\n  // message.\n  SourceContext source_context = 5;\n}\n\n// Method represents a method of an api.\nmessage Method {\n  // The simple name of this method.\n  string name = 1;\n\n  // A URL of the input message type.\n  string request_type_url = 2;\n\n  // If true, the request is streamed.\n  bool request_streaming = 3;\n\n  // The URL of the output message type.\n  string response_type_url = 4;\n\n  // If true, the response is streamed.\n  bool response_streaming = 5;\n\n  // Any metadata attached to the method.\n  repeated Option options = 6;\n}\n```\n```swift\nGoogle.Protobuf.Api()\n```\n\n#### Duration\n```protobuf\nmessage Duration {\n  // Signed seconds of the span of time. Must be from -315,576,000,000\n  // to +315,576,000,000 inclusive.\n  int64 seconds = 1;\n\n  // Signed fractions of a second at nanosecond resolution of the span\n  // of time. Durations less than one second are represented with a 0\n  // `seconds` field and a positive or negative `nanos` field. For durations\n  // of one second or more, a non-zero value for the `nanos` field must be\n  // of the same sign as the `seconds` field. Must be from -999,999,999\n  // to +999,999,999 inclusive.\n  int32 nanos = 2;\n}\n```\n```swift\nGoogle.Protobuf.Duration()\n```\n#### Empty\n\n```protobuf\nmessage Empty {\n}\n```\n\n```swift\nGoogle.Protobuf.Empty()\n```\n\n#### Field Mask\n\n```protobuf\nmessage FieldMask {\n  // The set of field mask paths.\n  repeated string paths = 1;\n}\n```\n\n```swift\nGoogle.Protobuf.FieldMask()\n```\n#### Source context\n\n```protobuf\nmessage SourceContext {\n  // The path-qualified name of the .proto file that contained the associated\n  // protobuf element.  For example: `\"google/protobuf/source.proto\"`.\n  string file_name = 1;\n}\n```\n\n```swift\nGoogle.Protobuf.SourceContext()\n```\n\n#### Struct\n\n```protobuf\nmessage Struct {\n  // Map of dynamically typed values.\n  map\u003cstring, Value\u003e fields = 1;\n}\n\n// `Value` represents a dynamically typed value which can be either\n// null, a number, a string, a boolean, a recursive struct value, or a\n// list of values. A producer of value is expected to set one of that\n// variants, absence of any variant indicates an error.\nmessage Value {\n  oneof kind {\n    // Represents a null value.\n    NullValue null_value = 1;\n\n    // Represents a double value.\n    double number_value = 2;\n\n    // Represents a string value.\n    string string_value = 3;\n\n    // Represents a boolean value.\n    bool bool_value = 4;\n\n    // Represents a structured value.\n    Struct struct_value = 5;\n\n    // Represents a repeated `Value`.\n    ListValue list_value = 6;\n  }\n}\n\n// `ListValue` is a wrapper around a repeated field of values.\nmessage ListValue {\n  // Repeated field of dynamically typed values.\n  repeated Value values = 1;\n}\n\n// `NullValue` is a singleton enumeration to represent the null\n// value for the `Value` type union.\nenum NullValue {\n  // Null value.\n  NULL_VALUE = 0;\n}\n```\n\n```swift\nGoogle.Protobuf.Struct()\n```\n\n#### Timestamp\n```protobuf\nmessage Timestamp {\n  // Represents seconds of UTC time since Unix epoch\n  // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to\n  // 9999-12-31T23:59:59Z inclusive.\n  int64 seconds = 1;\n\n  // Non-negative fractions of a second at nanosecond resolution. Negative\n  // second values with fractions must still have non-negative nanos values\n  // that count forward in time. Must be from 0 to 999,999,999\n  // inclusive.\n  int32 nanos = 2;\n}\n```\n```swift\nGoogle.Protobuf.Timestamp()\n```\n\n#### Type\n```protobuf\nmessage Type {\n  // The fully qualified message name.\n  string name = 1;\n\n  // The list of fields.\n  repeated Field fields = 2;\n\n  // The list of oneof definitions.\n  // The list of oneofs declared in this Type\n  repeated string oneofs = 3;\n\n  // The proto options.\n  repeated Option options = 4;\n\n  // The source context.\n  SourceContext source_context = 5;\n}\n\n// Field represents a single field of a message type.\nmessage Field {\n  // Kind represents a basic field type.\n  enum Kind {\n    // Field type unknown.\n    TYPE_UNKNOWN = 0;\n\n    // Field type double.\n    TYPE_DOUBLE = 1;\n\n    // Field type float.\n    TYPE_FLOAT = 2;\n\n    // Field type int64.\n    TYPE_INT64 = 3;\n\n    // Field type uint64.\n    TYPE_UINT64 = 4;\n\n    // Field type int32.\n    TYPE_INT32 = 5;\n\n    // Field type fixed64.\n    TYPE_FIXED64 = 6;\n\n    // Field type fixed32.\n    TYPE_FIXED32 = 7;\n\n    // Field type bool.\n    TYPE_BOOL = 8;\n\n    // Field type string.\n    TYPE_STRING = 9;\n\n    // Field type message.\n    TYPE_MESSAGE = 11;\n\n    // Field type bytes.\n    TYPE_BYTES = 12;\n\n    // Field type uint32.\n    TYPE_UINT32 = 13;\n\n    // Field type enum.\n    TYPE_ENUM = 14;\n\n    // Field type sfixed32.\n    TYPE_SFIXED32 = 15;\n\n    // Field type sfixed64.\n    TYPE_SFIXED64 = 16;\n\n    // Field type sint32.\n    TYPE_SINT32 = 17;\n\n    // Field type sint64.\n    TYPE_SINT64 = 18;\n  }\n\n  // Cardinality represents whether a field is optional, required, or\n  // repeated.\n  enum Cardinality {\n    // The field cardinality is unknown. Typically an error condition.\n    CARDINALITY_UNKNOWN = 0;\n\n    // For optional fields.\n    CARDINALITY_OPTIONAL = 1;\n\n    // For required fields. Not used for proto3.\n    CARDINALITY_REQUIRED = 2;\n\n    // For repeated fields.\n    CARDINALITY_REPEATED = 3;\n  }\n\n  // The field kind.\n  Kind kind = 1;\n\n  // The field cardinality, i.e. optional/required/repeated.\n  Cardinality cardinality = 2;\n\n  // The proto field number.\n  int32 number = 3;\n\n  // The field name.\n  string name = 4;\n\n  // The type URL (without the scheme) when the type is MESSAGE or ENUM,\n  // such as `type.googleapis.com/google.protobuf.Empty`.\n  string type_url = 6;\n\n  // Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.\n  int32 oneof_index = 7;\n\n  // Whether to use alternative packed wire representation.\n  bool packed = 8;\n\n  // The proto options.\n  repeated Option options = 9;\n}\n\n// Enum type definition.\nmessage Enum {\n  // Enum type name.\n  string name = 1;\n\n  // Enum value definitions.\n  repeated EnumValue enumvalue = 2;\n\n  // Proto options for the enum type.\n  repeated Option options = 3;\n\n  // The source context.\n  SourceContext source_context = 4;\n}\n\n// Enum value definition.\nmessage EnumValue {\n  // Enum value name.\n  string name = 1;\n\n  // Enum value number.\n  int32 number = 2;\n\n  // Proto options for the enum value.\n  repeated Option options = 3;\n}\n\n// Proto option attached to messages/fields/enums etc.\nmessage Option {\n  // Proto option name.\n  string name = 1;\n\n  // Proto option value.\n  Any value = 2;\n}\n```\n```swift\nGoogle.Protobuf.Type()\n...\n```\n\n#### Wrappers\n\n```protobuf\n// Wrapper message for double.\nmessage DoubleValue {\n  // The double value.\n  double value = 1;\n}\n\n// Wrapper message for float.\nmessage FloatValue {\n  // The float value.\n  float value = 1;\n}\n\n// Wrapper message for int64.\nmessage Int64Value {\n  // The int64 value.\n  int64 value = 1;\n}\n\n// Wrapper message for uint64.\nmessage UInt64Value {\n  // The uint64 value.\n  uint64 value = 1;\n}\n\n// Wrapper message for int32.\nmessage Int32Value {\n  // The int32 value.\n  int32 value = 1;\n}\n\n// Wrapper message for uint32.\nmessage UInt32Value {\n  // The uint32 value.\n  uint32 value = 1;\n}\n\n// Wrapper message for bool.\nmessage BoolValue {\n  // The bool value.\n  bool value = 1;\n}\n\n// Wrapper message for string.\nmessage StringValue {\n  // The string value.\n  string value = 1;\n}\n\n// Wrapper message for bytes.\nmessage BytesValue {\n  // The bytes value.\n  bytes value = 1;\n}\n```\n```swift\nGoogle.Protobuf.StringValue()\n```\n\n\nCredits\n=======\n\nDeveloper - Alexey Khokhlov\n\nGoogle Protocol Buffers - Cyrus Najmabadi, Sergey Martynov, Kenton Varda, Sanjay Ghemawat, Jeff Dean, and others\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexeyxo%2Fprotobuf-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexeyxo%2Fprotobuf-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexeyxo%2Fprotobuf-swift/lists"}