GenerallyHelpfulSoftware / SVGgh

A framework for using SVG artwork in iOS Apps. Includes a UIView and a button class, printing and PDF export.
MIT License
142 stars 37 forks source link

Add support for SVGZ #29

Closed ryanholden8 closed 8 years ago

ryanholden8 commented 8 years ago

Hi Glenn,

I have a situation where many SVGs will be downloaded via a server and stored on the user's device in the order of several 10s of MB. Storing SVGZ files will save a lot of space for the user, for this situation. File to fully rendered performance difference is extremely negligible (within 1MS of each other on a iPhone 5) and performance can even be slightly faster in some situations because of the reduced File I/O.

See: https://www.w3.org/TR/SVG11/conform.html#ConformingSVGViewers (Bullet Point: SVG implementations must correctly support gzip-encoded)

grhowes commented 8 years ago

Hi Ryan, I'm at my day job. So I'll look at this later in the day.

I'm wondering if this should be handled at the SVGghLoader level too. I support runtime installation of a loader, but I hadn't thought to do it with a stream.

grhowes commented 8 years ago

So, this will work with an XCAsset, as well as a subpath? I guess it won't need to modify the loaders.

ryanholden8 commented 8 years ago

Just added XCAsset support, unfortunately GzipInputStream does not support NSData so I pulled in NSData+IDZGunzip to handle that. GzipInputStream gets better performance though, so I left it.

grhowes commented 8 years ago

Hi Ryan, I fixed some compile warning and merged your pull request. Thanks for the contribution. I'm sure a lot of people would like to use SVGz.

ryanholden8 commented 8 years ago

Thank you, Glenn!