A Swift framework with classes for reading and writing bits and bytes.
BitByteData can be integrated into your project using Swift Package Manager, CocoaPods or Carthage.
Swift Package Manager
To install using SPM, add BitByteData to you package dependencies and specify it as a dependency for your target, e.g.:
import PackageDescription let package = Package( name: "PackageName", dependencies: [ .package(url: "https://github.com/tsolomko/BitByteData.git", from: "1.1.0") ], targets: [ .target( name: "TargetName", dependencies: ["BitByteData"] ) ] )
More details you can find in Swift Package Manager's Documentation.
pod 'BitByteData', '~> 1.1' and
use_frameworks! to your Podfile.
To complete installation, run
Add to your Cartfile
github "tsolomko/BitByteData" ~> 1.1.
Finally, drag and drop
into the "Embedded Binaries" section on your targets' "General" tab in Xcode.
ByteReader class to read bytes.
For reading bits there are two classes:
MsbBitReader, which implement
for two bit-numbering schemes ("LSB 0" and "MSB 0" correspondingly).
MsbBitReader classes inherit from
ByteReader so you can also use them to read bytes
(but they must be aligned, see documentation for more details).
Writing bits is implemented in two classes
MsbBitWriter (again, for two bit-numbering schemes).
They both conform to
Note: All readers and writers aren't structs, but classes intentionally.
This is done to make it easier to pass them as arguments to functions and to eliminate unnecessary copying and
Every function or type of BitByteData's public API is documented. This documentation can be found at its own website.
Whether you find a bug, have a suggestion, idea or something else, please create an issue on GitHub.
If you'd like to contribute code, please create a pull request on GitHub.
Note: If you are considering working on BitByteData, please note that Xcode project (BitByteData.xcodeproj)
was created manually and you shouldn't use
swift package generate-xcodeproj command.
Help us keep the lights on
1.2.0-test.2 - Mar 17, 2018
In this second test release several precondition checks introduced in the previous test release were corrected, as well as more missing functions were added.
1.2.0-test - Mar 14, 2018
The main purpose of the upcoming 1.2.0 update is to add missing functionality in terms of return types and bit/byte reading.
Also, the current plan is to wait for the 4.1 release of Swift language and only then release 1.2.0 update, so any necessary modifications required by the new version of Swift can be released without delay.
1.1.1 - Mar 4, 2018
- Added missing documentation for
- Temporary disable symbol stripping in Xcode project to prevent symbols being stripped in archives published on GitHub Releases, until Carthage releases an update that solves this issue (these archives are generated by Carthage).
1.1.0 - Mar 2, 2018
init(_ byteReader:)initializer to
MsbBitReaderclasses (as well as
BitReaderprotocol). It allows to convert
ByteReaderinstance into bit reader while preserving reading offset.
bitsReadcomputed properties to
MsbBitReaderclasses (as well as
On a side note, I started a new branch where I try some improvements to the API. Depending on their impact on existing functionality and framework-user code they will be either released pretty soon or not (in 2.0.0 version).
1.1.0-test - Feb 17, 2018
In the upcoming 1.1.0 update a new initializer will be added both to
MsbBitReader which performs conversion from