Contents

init(compressedContentsOfDirectoryAtURL:)

Creates an attachment containing a zipped archive of an existing directory on disk.

Declaration

convenience init(compressedContentsOfDirectoryAtURL url: URL)

Parameters

  • url:

    A file URL for a directory whose contents should be compressed.

Discussion

Zips the contents of the provided directory and wraps the compressed output in an attachment with a uniformTypeIdentifier of "public.zip-archive". The attachment’s name property is set to the name of the zipped directory followed by an extension of ".zip".

Available on macOS only.

See Also

Creating Attachments from Files and Folders