Super light Bit operation library in Swift.
Features • Usage • Installation • Documentation • Author • License
Full support of UInt8
, UInt32
and UInt64
.
- Byte accesors
- Bitwise arithmetic
- Representation convertors
let val1 = 0xA5C964F2 as UInt32
val1.firstByte //0xF2
val1.secondByte //0x64
val1.thirdByte //0xC9
val1.fourthByte //0xA5
let val1 = 0x00000001 as UInt32
val1.rotateLeft(0x00000002) //0x00000004
val1.rotateRight(0x00000002) //0x40000000
val1.reverseBytes() //0x01000000
Representations.toUInt8Array(64) //[UInt8(0x00), UInt8(0x00), UInt8(0x00), UInt8(0x00), UInt8(0x00), UInt8(0x00), UInt8(0x00), UInt8(0x40)]
Representations.mergeToUInt32Array([UInt8(0x01), UInt8(0x01), UInt8(0x01), UInt8(0x01),UInt8(0x01), UInt8(0x01), UInt8(0x01), UInt8(0x01)]) //UInt32(0x01010101), UInt32(0x01010101)]
Representations.toHexadecimalString([UInt8(0x01), UInt8(0x01), UInt8(0x01), UInt8(0x01)]) //"01010101"
-
OS X 10.9+ / iOS 8.0+ / watchOS 2.0 / tvOS 9.0
-
Xcode 7.1+, Swift 2.1+
CocoaPods is a centralized dependency manager for Objective-C and Swift. Go here to learn more.
-
Add the project to your Podfile.
use_frameworks! pod 'Bit'
-
Run
pod install
and open the.xcworkspace
file to launch Xcode. -
Import the Cryptography framework.
import Bit
Carthage is a decentralized dependency manager for Objective-C and Swift.
-
Add the project to your Cartfile.
github "mlachmish/Bit"
-
Run
carthage update
and follow the additional steps in order to add Cryptography to your project. -
Import the Cryptography framework.
import Bit
###Swift Package Manager
You can use Swift Package Manager and specify dependency in Package.swift
by adding this:
.Package(url: "https://github.com/mlachmish/Bit.git", majorVersion: 0)
Download and drop /Bit
folder in your project.
Matan Lachmish a.k.a The Big Fat Ninja
https://thebigfatninja.xyz
Icon made by Freepik from www.flaticon.com
Bit is available under the MIT license. See the LICENSE file for more info.