Search code examples
zipfoundation

Can a ZipFoundation Archive be sent as data in a mail attachment?


I need to zip up some logs and send them as a mail attachment

MFMailComposeViewController has a method for attachments func addAttachmentData(_ attachment: Data, mimeType: String, fileName filename: String)

But it only accepts a Data object. Is there an easy way to get the Data of the archive directly, or do I need to save to file, then read the data from file, then delete the file?


Solution

  • according to this pull request, ZIPFoundation will have support for Data type in the next release.