Swift 将DaSwift Data数据转换为[UInt8](bytes字节数组)

245 阅读1分钟

方式1:

let bytes = [UInt8](data)
print(bytes)

方式2:

let bytes = data.withUnsafeBytes {
    [UInt8](UnsafeBufferPointer(start: $0, count: data.count))
}
print(bytes)