Unzip files in swift

后端 未结 5 744
一整个雨季
一整个雨季 2020-12-16 04:22

How to go about unzipping a file in swift? In Objective-C, I used SSZipArchive and I loved it. As seen in the code below. I suspect if I decide to keep SSZipArchive, I will

5条回答
  •  独厮守ぢ
    2020-12-16 04:51

    If you're using any of UIKit or AppKit, you're already working with a Swift-ObjC bridge. Don't worry about that, just use the library you know and love!

    let zipPath = globalFileStrucure.stringByAppendingPathComponent("zipfile.zip")
    data.writeToFile(zipPath, options: nil, error: &error)
    
    let unZipped = SSZipArchive.unzipFileAtPath(zipPath, toDestination: globalFileStrucure)
    

提交回复
热议问题