'how can I change UnsafeMutableBufferPointer to withUnsafeMutablePointer?
I got a warning for the following function after a recent update, I am not sure how to convert it with withUnsafeMutablePointer as indicated by Xcode, not very familiar with swift.
var number: UInt16 = 0
let realStartIndex = index+self.startIndex
self.copyBytes(to: UnsafeMutableBufferPointer(start: &number, count: 2), from:
realStartIndex..<(realStartIndex+MemoryLayout<UInt16>.size))
return number
}```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|