I am new to Swift and iOS Development.
How do we clear an NSMutableData without using release and then re-alloc/init again to be used again?
I have tried resetBytesInRange() but that replaces the contents by zero.
I tried data.length = 0, but there is garbage data at the end after appending.
data.setData(nil) gives an error.
I read this question but it doesn't solve my problem on swift.
Please help.
Try using setData() with NSData():
mytableData.setData(NSData())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With