class FileManager : NSObject
Zips the file or direcory contents at the specified source URL to the destination URL.
If the item at the source URL is a directory, the directory itself will be represented within the ZIP
Archive. Calling this method with a directory URL
file:///path/directory/will create an archive with a
directory/entry at the root level. You can override this behavior by passing
shouldKeepParent. In that case, the contents of the source directory will be placed at the root of the archive.
ThrowsThrows an error if the source item does not exist or the destination URL is not writable.
public func zipItem(at sourceURL: URL, to destinationURL: URL, shouldKeepParent: Bool = true, compressionMethod: CompressionMethod = .none, progress: Progress? = nil) throws
The file URL pointing to an existing file or directory.
The file URL that identifies the destination of the zip operation.
Indicates that the directory name of a source item should be used as root element within the archive. Default is
CompressionMethodthat should be applied.
A progress object that can be used to track or cancel the zip operation.