Hi all, Swift PNG 4 is now here! The biggest change is that the library is now pure Swift, with its own DEFLATE engine, which means it no longer has a system dependency on zlib
. In addition, the entire API has been revamped, and the library has an API reference website now. Version 4.0 also bring first-class support for iPhone-optimized PNG files.
As always, feedback is welcome and appreciated.
tutorials and example programs
- basic decoding (sources)
- basic encoding (sources)
- using indexed images (sources)
- using iphone-optimized images (sources)
- working with metadata (sources)
- using in-memory images (sources)
- online decoding (sources)
- custom color targets (sources)
api reference
Finally, an aside that might be interesting even if you are not going to use the library: the efficiency of the machine code generated by the Swift compiler really does seem to be improving over time. Here are some execution-time plots for the same version of Swift PNG when built against various nightly toolchains from the past year:
(Note that the execution-time curve for the DEVELOPMENT-SNAPSHOT-2020-07-11-a
toolchain is not visible, because that toolchain had a severe performance regression that puts it outside the viewbox of the graphs.)
So I guess there really is some truth to the claim that pure Swift frameworks improve passively as the compiler matures.