From 2886108b12a7b493628ccbc379372ca895991057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20C=C5=93ur?= Date: Tue, 10 Oct 2017 16:42:00 +0800 Subject: [PATCH] more flexible sample apps --- .../ObjectiveCExample/ViewController.m | 7 ++++++- SwiftExample/SwiftExample/ViewController.swift | 16 +++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ObjectiveCExample/ObjectiveCExample/ViewController.m b/ObjectiveCExample/ObjectiveCExample/ViewController.m index 8ddbad2..6bdff25 100644 --- a/ObjectiveCExample/ObjectiveCExample/ViewController.m +++ b/ObjectiveCExample/ObjectiveCExample/ViewController.m @@ -68,9 +68,14 @@ NSString *password = _passwordField.text; BOOL success = [SSZipArchive unzipFileAtPath:_zipPath toDestination:unzipPath + preserveAttributes:YES overwrite:YES + nestedZipLevel:0 password:password.length > 0 ? password : nil - error:nil]; + error:nil + delegate:nil + progressHandler:nil + completionHandler:nil]; if (success) { NSLog(@"Success unzip"); } else { diff --git a/SwiftExample/SwiftExample/ViewController.swift b/SwiftExample/SwiftExample/ViewController.swift index 7a8404d..541b834 100644 --- a/SwiftExample/SwiftExample/ViewController.swift +++ b/SwiftExample/SwiftExample/ViewController.swift @@ -70,11 +70,17 @@ class ViewController: UIViewController { } let password = passwordField.text - let success: Void? = try? SSZipArchive.unzipFile(atPath: zipPath, - toDestination: unzipPath, - overwrite: true, - password: password?.isEmpty == false ? password : nil) - if success != nil { + let success: Bool = SSZipArchive.unzipFile(atPath: zipPath, + toDestination: unzipPath, + preserveAttributes: true, + overwrite: true, + nestedZipLevel: 1, + password: password?.isEmpty == false ? password : nil, + error: nil, + delegate: nil, + progressHandler: nil, + completionHandler: nil) + if success != false { print("Success unzip") } else { print("No success unzip")