import ZIPFoundation import Foundation let fileManager = FileManager.default let sourceURL = URL(fileURLWithPath: "/path/to/directory") let destinationURL = URL(fileURLWithPath: "/path/to/archive.zip") do { try fileManager.zipItem(at: sourceURL, to: destinationURL) print("Archive created successfully!") } catch { print("Creation failed with error: \(error)") } Use code with caution. Copied to clipboard Tips for Better Archiving
How to easily create ZIP files in Swift without third-party dependencies siwt.zip
: Sending one file over a network is often faster than sending fifty. siwt.zip