New release: Swift PNG 4.0

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

  1. basic decoding (sources)
  2. basic encoding (sources)
  3. using indexed images (sources)
  4. using iphone-optimized images (sources)
  5. working with metadata (sources)
  6. using in-memory images (sources)
  7. online decoding (sources)
  8. 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.

17 Likes
Terms of Service

Privacy Policy

Cookie Policy