John B.
John B.

Reputation: 682

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.

Upvotes: 1

Views: 1147

Answers (2)

HuaTham
HuaTham

Reputation: 7596

You could simply serialize and archive your images instead before AirDrop sharing. See AirDropSample.

Upvotes: 0

John B.
John B.

Reputation: 682

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.

Upvotes: 1

Related Questions