I had this:
let alphaPtr = UnsafeMutablePointer(mutating: alpha) as UnsafeMutablePointer?
W
Try this
var bytes = [UInt8]() let uint8Pointer = UnsafeMutablePointer.allocate(capacity: bytes.count) uint8Pointer.initialize(from: &bytes, count: bytes.count)