mw99/DataCompression

Xcode deprecation warnings for withUnsafeBytes

klauslanza opened this issue · 3 comments

Is there any plan to fix the deprecations for

'withUnsafeBytes is deprecated: use withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R instead

or is there a reasoning behind?

Thanks for the great work

mw99 commented

Hi!

The fileprivate extension in line 436 should actually prevent that deprecation warning from appearing. I just tested with Xcode 11.3.1 and I don't see any warnings. Do you use any special warning compiler switches? Also tell me about your environment (e.g. Xcode version...).

Hi,
you're right, sorry for the wrong issue! I was using this great lib with manual importing, and the fileprivate got lost in the move.
I'm using Xcode Version 11.3.1, and now it's all fixed.

Apart from that, I suppose int the long run this could be moved to a non-deprecated one, for better use.
Thanks

mw99 commented

Ah nice. Problems that solve themselves are the best.

Apart from that, I suppose int the long run this could be moved to a non-deprecated one, for better use.

Yes, I know what you mean. That was also my first intention when the warning appeared, but the new alternative (I think its called withUnsafeBufferBytes?) does force me to do a forced unwrapping. (Swift !). And the documentation never states when the Data type would result in a nil pointer there. That's all pretty messy. So for now we stay safe and use the deprecated methods.