{"id":15038391,"url":"https://github.com/stickytools/sticky-encoding","last_synced_at":"2025-04-09T23:41:01.276Z","repository":{"id":62456122,"uuid":"129652085","full_name":"stickytools/sticky-encoding","owner":"stickytools","description":"High-performance binary encoding/decoding for `Swift.Codable` types.","archived":false,"fork":false,"pushed_at":"2020-02-03T23:26:37.000Z","size":917,"stargazers_count":46,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T01:35:13.946Z","etag":null,"topics":["binary","binary-data","binary-decoding","binary-encoded","binary-encoding","codable","ios","linux","macos","osx","swift","swift-4","swift-codable","swift-decodable","swift-encodable"],"latest_commit_sha":null,"homepage":"https://stickytools.io/sticky-encoding","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/stickytools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-15T21:24:31.000Z","updated_at":"2024-07-11T15:54:33.000Z","dependencies_parsed_at":"2022-11-02T00:15:15.567Z","dependency_job_id":null,"html_url":"https://github.com/stickytools/sticky-encoding","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stickytools%2Fsticky-encoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stickytools%2Fsticky-encoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stickytools%2Fsticky-encoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stickytools%2Fsticky-encoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stickytools","download_url":"https://codeload.github.com/stickytools/sticky-encoding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131468,"owners_count":21052819,"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":["binary","binary-data","binary-decoding","binary-encoded","binary-encoding","codable","ios","linux","macos","osx","swift","swift-4","swift-codable","swift-decodable","swift-encodable"],"created_at":"2024-09-24T20:38:16.834Z","updated_at":"2025-04-09T23:41:01.251Z","avatar_url":"https://github.com/stickytools.png","language":"Swift","readme":"## ⚡️ Stay tuned for updates: upcoming version 1.0.0 (currently in beta) ⚡️\n\u003cp align=\"center\"\u003ePlease \u003ca href=\"https://github.com/tonystone/tracelog/stargazers\"\u003estar\u003c/a\u003e this github repository to stay up to date and show your support.\u003c/p\u003e\n\n# StickyEncoding ![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-lightgray.svg?style=flat)\n\n\u003ca href=\"https://github.com/stickytools/sticky-encoding/\" target=\"_blank\"\u003e\n   \u003cimg src=\"https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux%20-lightgray.svg?style=flat\" alt=\"Platforms: iOS | macOS | watchOS | tvOS | Linux\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/stickytools/sticky-encoding/\" target=\"_blank\"\u003e\n   \u003cimg src=\"https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat\" alt=\"Swift 4.2\"\u003e\n\u003c/a\u003e\n\u003ca href=\"http://cocoadocs.org/docsets/StickyEncoding\" target=\"_blank\"\u003e\n   \u003cimg src=\"https://img.shields.io/cocoapods/v/StickyEncoding.svg?style=flat\" alt=\"Version\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/stickytools/sticky-encoding\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://travis-ci.org/stickytools/sticky-encoding.svg?branch=master\" alt=\"travis-ci.org\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/stickytools/sticky-encoding\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://codecov.io/gh/stickytools/sticky-encoding/branch/master/graph/badge.svg\" alt=\"Codecov\" /\u003e\n\u003c/a\u003e\n\n---\nStickyEncoding facilitates the encoding and decoding of `Codable` values into and out of a binary\nformat that can be stored on disk or sent over a socket.\n\n## Documentation\n\n* [User Guides \u0026 Reference](https://stickytools.io/sticky-encoding) - Extensive user guides and reference documentation!  100% documented API, full examples and many hidden details.\n* [Contributing Guide](CONTRIBUTING.md) - If you'd like to contribute and need instructions on the build environment, this is the place to go.\n\n## Quick Start Guide\n\nEncoding is done using a `BinaryEncoder` instance and will encode any `Encodable` type whether you declare conformance to `Encodable` and let the compiler create the code, or you manually implement the conformance yourself.\n\nDecoding is done using a `BinaryDecoder` instance and can decode any `Decodable` type that was previously encoded using the `BinaryEncoder`. Of course you can declare `Encodable` or `Decodable` conformance by using `Codable` as well.\n\nStickyEncoding creates a compact binary format that represents the encoded object or data type.  You can read more about the format in the document [Binary Format](Sources/Documentation/Sections/Binary\u0026#32;Format.md).\n\nTo facilitate many use cases, StickyEncoding encodes the data to an instance of `EncodedData`.  EncodedData contains a binary format suitable\nfor writing directly to memory, disk, or into a byte array. Or in the case of decoding, the format facilitates rapid decoding to Swift instances.\n\n### Encoding\n\nTo create an instance of a BinaryEncoder:\n```Swift\n    let encoder = BinaryEncoder()\n```\n\n\u003e Note: You may optionally pass your own userInfo `BinaryEncoder(userInfo:)` structure and it will be available to you during the encoding.\n\nYou can encode any top-level single value type including Int,\nUInt, Double, Bool, and Strings. Simply pass the value to the instance\nof the BinaryEncoder and call `encode`.\n```Swift\n   let string = \"You can encode single values of any type.\"\n\n   let bytes = try encoder.encode(string)\n```\nBasic structs and classes can also be encoded.\n```Swift\n   struct Employee: Codable {\n        let first: String\n        let last: String\n        let employeeNumber: Int\n   }\n\n   let employee = Employee(first: \"John\", last: \"Doe\", employeeNumber: 2345643)\n\n   let bytes = try encoder.encode(employee)\n```\nAs well as Complex types with sub classes.\n\n### Decoding\n\nTo create an instance of a BinaryDecoder:\n```Swift\n    let decoder = BinaryDecoder()\n```\n\n\u003e Note: You may optionally pass your own userInfo `BinaryDecoder(userInfo:)` structure and it will be available to you during the decoding.\n\nTo decode, you pass the Type of object to create, and an instance of encoded data representing that type.\n```Swift\n   let employee = try decoder.decode(Employee.self, from: bytes)\n```\n\n### Encoded Data\n\nThe `BinaryEncoder.encode` method returns type `Array\u003cUInt8\u003e` (likewise `BinaryDecoder.decode` accepts an `Array\u003cUInt8\u003e` instance).\n\n`[Array\u003cUInt8\u003e` is easily converted to other types such as `Swift.Data` for passing to Foundation methods to store and load data from file.\n```Swift\n   let bytes = try encoder.encode(employee)\n\n   // Write the bytes directly to a file.\n   FileManager.default.createFile(atPath: \"employee.bin\", contents: Data(bytes))\n```\n\n## Sources and Binaries\n\nYou can find the latest sources and binaries on [github](https://github.com/stickytools/sticky-encoding).\n\n## Communication and Contributions\n\n- If you **found a bug**, _and can provide steps to reliably reproduce it_, [open an issue](https://github.com/stickytools/sticky-encoding/issues).\n- If you **have a feature request**, [open an issue](https://github.com/stickytools/sticky-encoding/issues).\n- If you **want to contribute**\n   - Fork it! [StickyEncoding repository](https://github.com/stickytools/sticky-encoding)\n   - Create your feature branch: `git checkout -b my-new-feature`\n   - Commit your changes: `git commit -am 'Add some feature'`\n   - Push to the branch: `git push origin my-new-feature`\n   - Submit a pull request :-)\n\n\u003e Note: for a instructions on how to build and test StickyEncoding for contributing please see the [Contributing Guide](CONTRIBUTING.md).\n\n## Installation\n\n### Swift Package Manager\n\n**StickyEncoding** supports dependency management via Swift Package Manager on Darwin as well as Linux.\n\nPlease see [Swift Package Manager](https://swift.org/package-manager/#conceptual-overview) for further information.\n\n### CocoaPods\n\nStickyEncoding is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\n   pod \"StickyEncoding\"\n```\n## Minimum Requirements\n\nBuild Environment\n\n| Platform | Swift | Swift Build | Xcode |\n|:--------:|:-----:|:----------:|:------:|\n| Linux    | 4.2 | \u0026#x2714; | \u0026#x2718; |\n| OSX      | 4.2 | \u0026#x2714; | Xcode 10.2 |\n\nMinimum Runtime Version\n\n| iOS |  OS X | tvOS | watchOS | Linux |\n|:---:|:-----:|:----:|:-------:|:------------:|\n| 8.0 | 10.10 | 9.0  |   2.0   | Ubuntu 14.04, 16.04, 16.10 |\n\n\u003e **Note:**\n\u003e\n\u003e To build and run on **Linux** we have a a preconfigure **Vagrant** file located at [https://github.com/tonystone/vagrant-swift](https://github.com/tonystone/vagrant-swift)\n\u003e\n\u003e See the [README](https://github.com/tonystone/vagrant-swift/blob/master/README.md) for instructions.\n\u003e\n\n## Author\n\nTony Stone ([https://github.com/tonystone](https://github.com/tonystone))\n\n## License\n\nStickyEncoding is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstickytools%2Fsticky-encoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstickytools%2Fsticky-encoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstickytools%2Fsticky-encoding/lists"}