I am seeing a deprecation warning from xcode for using withUnsafeBytes. Below is the code snippet. Can anyone suggest the right way to use withUnsafeBytes without throwing the warning : withUnsafeBytes' is deprecated: use withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R
instead. I have tried few other links and solutions but nothing seems to be working.
var keyBytes = data.withUnsafeBytes {
[UInt8](UnsafeBufferPointer(start: $0, count: data.count))
}