do { let filePath =Bundle.main.url(forResource: "file", withExtension: "zip")! let unzipDirectory =tryZip.quickUnzipFile(filePath) // Unzip let zipFilePath =tryZip.quickZipFiles([filePath], fileName: "archive") // Zip } catch { print("Something went wrong") }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do { let filePath =Bundle.main.url(forResource: "file", withExtension: "zip")! let documentsDirectory =FileManager.default.urls(for:.documentDirectory, in: .userDomainMask)[0] tryZip.unzipFile(filePath, destination: documentsDirectory, overwrite: true, password: "password", progress: { (progress) -> () in print(progress) }) // Unzip
let zipFilePath = documentsFolder.appendingPathComponent("archive.zip") tryZip.zipFiles([filePath], zipFilePath: zipFilePath, password: "password", progress: { (progress) -> () in print(progress) }) //Zip