John B. John B. - 5 months ago 127
iOS Question

Swift: How to zip multiple NSData objects for further transfer (Airdrop, Email, Dropbox...)

In my iOS Swift application I have images stored as NSData in a Realm database. Now I want to combine these images (or a subset query of them) into a single ZIP file and make it available for further transfer via Airdrop, Email and so on.

I am fine with how to transfer and how to get them out of the database but I have no clue how to create a single ZIP file out of a bunch of NSData objects.

Answer

After changing some keywords in Google for the search, I found 2 interesting looking Libs/Frameworks I now will start investigating in.

ZIP from Marmelroy

and

ZipArchive

Both can be found on GitHub. I have no big experiences with both of them at the moment. But ZipArchiveseems to have options for NSDataSupport as this is already stated in the Readme

Zip-up NSData instances. (with a filename)

So this might be an indicator for me.

Comments