I am migrating from Swift 2 to Swift 3 and I am stuck at one point.
Swift 2
let arr = UnsafePointer<UInt32>(UnsafePointer<UInt8>(buf).advanced(by: off)) let msk = arr[0].bigEndian & 0x7fffffff I get an error on first line saying
'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.
I tried to use withMemoryoRebound method but I am not sure about the parameters. As per this docuentation, UnsafePointer<> has been replaced by UnsafeRawPointer. So I changed my code as below
let arr = UnsafeRawPointer(UnsafePointer<UInt8>(buf).advanced(by: off)) let msk = arr[0].bigEndian & 0x7fffffff But here on the second line it says
Type 'UnsafeRawPointer' has no subscript members
How can I successfully convert it to Swift 3?