Facebook created an opensource fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios, called ZStandard.
I have been looking for a tutorial that describes the c to swift wrapping, like this, but looks not comprehensive enough, what are the prerequests do I have to know before writing a wrapper?
Thank you for a good question. I've looked at the library and played with it, it seems pretty interesting.
I would say you need to be comfortable using the ZSTD C library in a C program. You need to be also comfortable programming in Swift. Depending on the parts of the API you want to wrap, you may need to understand how to deal with raw memory in Swift (
Some challenges to consider when wrapping ZSTD:
There is a multitude of approaches you can choose from when writing a wrapper. For example, you can write wrappers in C that will expose simple APIs you will wrap in Swift. You can include C code in your wrapper framework, or you can keep it in separate C libraries.
I have come up with a simple example of a wrapper around a small subset of the API, you can take a look at https://github.com/omniprog/SwiftZSTD.