I couldn\'t find a solution to this problem in Swift (all of them are Objective-C, and they deal with pointers which I don\'t think exist in Swift in the same form). Is ther
swift 4 and image data to a byte array.
func getArrayOfBytesFromImage(imageData:Data) ->[UInt8]{ let count = imageData.count / MemoryLayout.size var byteArray = [UInt8](repeating: 0, count: count) imageData.copyBytes(to: &byteArray, count:count) return byteArray }