123456789101112131415161718 |
- import UIKit
- extension Data {
- public func arrayOfBytes() -> [UInt8] {
- let count = self.count / MemoryLayout<UInt8>.size
- var bytesArray = [UInt8](repeating: 0, count: count)
- (self as NSData).getBytes(&bytesArray, length: count * MemoryLayout<UInt8>.size)
- return bytesArray
- }
- }
|