Convert bytes/UInt8 array to Int in Swift
There are two problems: Int is a 64-bit integer on 64-bit platforms, your input data has only 32-bit. Int uses a little-endian representation on all current Swift platforms, your input is big-endian. That being said the following would work: let array : [UInt8] = [0, 0, 0, 0x0E] var value : UInt32 = 0 let … Read more