Swift로 파일 압축, 해제를 간단하게 사용할 수 있는 라이브러리이다. minzip이라는 라이브러리를 기반으로 두고있음. MinZip은 C로 작성된 파일 압축/해제 라이브러리이다. Win, macOS, Linux를 지원하는.

Zip

https://github.com/marmelroy/Zip

Sample Code

do {
    let filePath = Bundle.main.url(forResource: "file", withExtension: "zip")!
    let documentsDirectory = FileManager.default.urls(for:.documentDirectory, in: .userDomainMask)[0]
    try Zip.unzipFile(filePath, destination: documentsDirectory, overwrite: true, password: "password", progress: { (progress) -> () in
        print(progress)
    }) // Unzip

    let zipFilePath = documentsFolder.appendingPathComponent("archive.zip")
    try Zip.zipFiles([filePath], zipFilePath: zipFilePath, password: "password", progress: { (progress) -> () in
        print(progress)
    }) //Zip

}
catch {
  print("Something went wrong")
}