How to migrate this code to Swift 3?
let keyBytes = keyData.bytes.bindMemory(to: Void.self, capacity: keyData.count)
I'm getting below error
'bytes' is unavailable: use withUnsafeBytes instead
keyData
is type of Data
object and that doesn't have property bytes
, convert keyData
to NSData
and then access bytes
.
let keyBytes = NSData(data: keyData).bytes.bindMemory(to: Void.self, capacity: keyData.count)