{"id":15038680,"url":"https://github.com/fitnesskit/datadecoder","last_synced_at":"2025-04-09T23:53:01.849Z","repository":{"id":56908220,"uuid":"86822348","full_name":"FitnessKit/DataDecoder","owner":"FitnessKit","description":"Swift Data Decoder.  Easily Decode Data values","archived":false,"fork":false,"pushed_at":"2019-04-20T15:38:56.000Z","size":158,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T23:52:40.973Z","etag":null,"topics":["data-decoders","decoder","nsdata","swift","swift-package-manager","swift3"],"latest_commit_sha":null,"homepage":"https://fitnesskit.github.io/DataDecoder","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FitnessKit.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}},"created_at":"2017-03-31T13:31:24.000Z","updated_at":"2024-06-01T14:55:33.000Z","dependencies_parsed_at":"2022-08-20T19:50:29.817Z","dependency_job_id":null,"html_url":"https://github.com/FitnessKit/DataDecoder","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FitnessKit%2FDataDecoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FitnessKit%2FDataDecoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FitnessKit%2FDataDecoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FitnessKit%2FDataDecoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FitnessKit","download_url":"https://codeload.github.com/FitnessKit/DataDecoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131454,"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":["data-decoders","decoder","nsdata","swift","swift-package-manager","swift3"],"created_at":"2024-09-24T20:39:39.941Z","updated_at":"2025-04-09T23:53:01.823Z","avatar_url":"https://github.com/FitnessKit.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataDecoder\nSwift Data Decoder.  Easily Decode Data values\n\n[![Swift5](https://img.shields.io/badge/swift5-compatible-4BC51D.svg?style=flat)](https://developer.apple.com/swift)\n[![Version](https://img.shields.io/cocoapods/v/DataDecoder.svg?style=flat)](http://cocoapods.org/pods/DataDecoder)\n[![License](https://img.shields.io/cocoapods/l/DataDecoder.svg?style=flat)](http://cocoapods.org/pods/DataDecoder)\n[![Platform](https://img.shields.io/cocoapods/p/DataDecoder.svg?style=flat)](http://cocoapods.org/pods/DataDecoder)\n[![Readme Score](http://readme-score-api.herokuapp.com/score.svg?url=https://github.com/fitnesskit/datadecoder)](http://clayallsopp.github.io/readme-score?url=https://github.com/fitnesskit/datadecoder)\n\n## Installation\n\nDataDecoder is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"DataDecoder\"\n```\n\nSwift Package Manager:\n\n```swift\n    dependencies: [\n        .package(url: \"https://github.com/FitnessKit/DataDecoder\", from: \"5.0.0\"),\n    ]\n```\n\nSwift4\n```swift\n    dependencies: [\n        .package(url: \"https://github.com/FitnessKit/DataDecoder\", .branch(\"swift42\")),\n    ]\n```\n\n\n## How to Use ##\n\nExample:\n```swift\nlet sensorData: Data = Data([ 0x02, 0xFE, 0xFF, 0xEF, 0xBE, 0xAD, 0xDE, 0xA5])\n\nvar decoder = DecodeData()\nlet height = decoder.decodeUInt8(sensorData)\nlet weight = decoder.decodeUInt16(sensorData)\nlet deadbeef = decoder.decodeUInt32(sensorData)\nlet nib = decoder.decodeNibble(sensorData)\n//This should come back 0 as there is no more data left\nlet novalue = decoder.decodeNibble(sensorData)\n```\n\nExample Using Optionals:\n```swift\nlet sensorData: Data = Data([ 0x02, 0xFE, 0xFF, 0xEF, 0xBE, 0xAD, 0xDE, 0xA5])\n\nvar decoder = DecodeData()\n\nif let height = decoder.decodeUInt8IfPresent(sensorData) {}\nlet weight = decoder.decodeUInt16IfPresent(sensorData)\nlet deadbeef = decoder.decodeUInt32IfPresent(sensorData)\nlet nib = decoder.decodeNibbleIfPresent(sensorData)\n// This will be nil as there is no data left\nlet novalue = decoder.decodeUInt8IfPresent(sensorData)\n```\n\n## Data Decoders ##\n\n* Nibble\n* UInt8/Int8\n* UInt16/Int16\n* UInt24/Int23\n* UInt32/Int32\n* UInt48\n* UInt64/Int64\n* IP Address to String Value\n* MAC Address to String Value\n\n### IEEE-11073\n\n* 16-bit SFLOAT\n* 32-bit FLOAT\n\n### IEEE-754\n\n* Float32\n* Float64\n\n## Author\n\nThis package is developed and maintained by Kevin A. Hoogheem\n\n## License\n\nDataDecoder is available under the [MIT license](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitnesskit%2Fdatadecoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffitnesskit%2Fdatadecoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitnesskit%2Fdatadecoder/lists"}