diff --git a/Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint b/Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint index 05428776ac975b5b019615ed1803706ed91676d0..0b4f0601b4ab6655a53945f681d7c7211fc635a6 100644 --- a/Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint +++ b/Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint @@ -10,7 +10,7 @@ "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "F3707899-72AE-49DA-9BDD-5CB0B64CF03A", "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { "8DA5B175D3FDB92A3B3CCBD4109A734F1316A3DD" : "Zip\/Zip\/minizip\/", - "3DD768C8AB2D6A2647C9EF99992D3CC5820E77C4" : "Zip-swift3\/" + "3DD768C8AB2D6A2647C9EF99992D3CC5820E77C4" : "Zip\/" }, "DVTSourceControlWorkspaceBlueprintNameKey" : "Zip", "DVTSourceControlWorkspaceBlueprintVersion" : 204, diff --git a/Zip/QuickZip.swift b/Zip/QuickZip.swift index 02ba68c921c014424921ac719ca652ff0a2f5b49..a9d703fd67eabcea6b6072b739e0a336043941ff 100644 --- a/Zip/QuickZip.swift +++ b/Zip/QuickZip.swift @@ -37,7 +37,7 @@ extension Zip { - returns: NSURL of the destination folder. */ - public class func quickUnzipFile(_ path: URL, progress: ((progress: Double) -> ())?) throws -> URL { + public class func quickUnzipFile(_ path: URL, progress: ((_ progress: Double) -> ())?) throws -> URL { let fileManager = FileManager.default let fileExtension = path.pathExtension @@ -85,10 +85,10 @@ extension Zip { - returns: NSURL of the destination folder. */ - public class func quickZipFiles(_ paths: [URL], fileName: String, progress: ((progress: Double) -> ())?) throws -> URL { + public class func quickZipFiles(_ paths: [URL], fileName: String, progress: ((_ progress: Double) -> ())?) throws -> URL { let fileManager = FileManager.default let documentsUrl = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL - let destinationUrl = try! documentsUrl.appendingPathComponent("\(fileName).zip") + let destinationUrl = documentsUrl.appendingPathComponent("\(fileName).zip") try self.zipFiles(paths, zipFilePath: destinationUrl, password: nil, progress: progress) return destinationUrl } diff --git a/Zip/Zip.swift b/Zip/Zip.swift index 0097da9ae74d3d56eaf0c307da1239a338ff82e0..cd3a395077743eb210db29c117aae10635f753bc 100644 --- a/Zip/Zip.swift +++ b/Zip/Zip.swift @@ -62,7 +62,7 @@ public class Zip { - notes: Supports implicit progress composition */ - public class func unzipFile(_ zipFilePath: URL, destination: URL, overwrite: Bool, password: String?, progress: ((progress: Double) -> ())?) throws { + public class func unzipFile(_ zipFilePath: URL, destination: URL, overwrite: Bool, password: String?, progress: ((_ progress: Double) -> ())?) throws { // File manager let fileManager = FileManager.default @@ -112,7 +112,7 @@ public class Zip { throw ZipError.unzipFail } var fileInfo = unz_file_info64() - memset(&fileInfo, 0, sizeof(unz_file_info.self)) + memset(&fileInfo, 0, MemoryLayout.size) ret = unzGetCurrentFileInfo64(zip, &fileInfo, nil, 0, nil, 0, nil, 0) if ret != UNZ_OK { unzCloseCurrentFile(zip) @@ -179,7 +179,7 @@ public class Zip { // Update progress handler if let progressHandler = progress{ - progressHandler(progress: (currentPosition/totalSize)) + progressHandler((currentPosition/totalSize)) } progressTracker.completedUnitCount = Int64(currentPosition) @@ -188,7 +188,7 @@ public class Zip { // Completed. Update progress handler. if let progressHandler = progress{ - progressHandler(progress: 1.0) + progressHandler(1.0) } progressTracker.completedUnitCount = Int64(totalSize) @@ -209,7 +209,7 @@ public class Zip { - notes: Supports implicit progress composition */ - public class func zipFiles(_ paths: [URL], zipFilePath: URL, password: String?, progress: ((progress: Double) -> ())?) throws { + public class func zipFiles(_ paths: [URL], zipFilePath: URL, password: String?, progress: ((_ progress: Double) -> ())?) throws { // File manager let fileManager = FileManager.default @@ -291,7 +291,7 @@ public class Zip { // Update progress handler if let progressHandler = progress{ - progressHandler(progress: (currentPosition/totalSize)) + progressHandler((currentPosition/totalSize)) } progressTracker.completedUnitCount = Int64(currentPosition) @@ -305,7 +305,7 @@ public class Zip { // Completed. Update progress handler. if let progressHandler = progress{ - progressHandler(progress: 1.0) + progressHandler(1.0) } progressTracker.completedUnitCount = Int64(totalSize)