I am using the compression library of Swift to compress an image as NSData. This is the code:
var imageCompressed:NSData
compression_encode_buffer( imageCompressed ,800000 , imageSelected , size , NULL , COMPRESSION_LZMA )
I am getting the following error message:
Cannot convert value of type NSData to expected argument type UnsafeMutablePointer
As Matt has said you cannot write to an NSData object, because it is immutable. I strongly recommend that you use Swift Standard Library
Datatype instead. Then you could callwithUnsafeMutableBytesand do what you want inside its closure.