I have the following code, assuming data
is of type NSData?
:
if let myData = data {
let bytes = UnsafePointer<UInt8>(myData.bytes)
...
}
How do I reduce this to a single statement, such as:
if let bytes = UnsafePointer<UInt8>?(data?.bytes) {
...
}
The above gives an error of: Cannot invoke initializer for type 'UnsafePointer<UInt8>?' with an argument list of type '(UnsafePointer<Void>?)'