diff --git a/ObjectiveCExample/Podfile.lock b/ObjectiveCExample/Podfile.lock index f97482c..2054c07 100644 --- a/ObjectiveCExample/Podfile.lock +++ b/ObjectiveCExample/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - SSZipArchive (1.5) + - SSZipArchive (1.6) DEPENDENCIES: - SSZipArchive (from `..`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: ".." SPEC CHECKSUMS: - SSZipArchive: 29daace2bccb90a47de2837744da397728ff9207 + SSZipArchive: e3560652173f5fe708a835632e63e38b9000bdb7 PODFILE CHECKSUM: ae5fb993e5dc339b15e10067d1e60549fa585f32 -COCOAPODS: 1.1.0.beta.1 +COCOAPODS: 1.1.0.rc.1 diff --git a/SSZipArchive.podspec b/SSZipArchive.podspec index 9cee51d..52eec63 100644 --- a/SSZipArchive.podspec +++ b/SSZipArchive.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SSZipArchive' - s.version = '1.5' + s.version = '1.6' s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.' s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.' s.homepage = 'https://github.com/ZipArchive/ZipArchive' diff --git a/SwiftExample/Podfile.lock b/SwiftExample/Podfile.lock index 3a6ee2f..c973420 100644 --- a/SwiftExample/Podfile.lock +++ b/SwiftExample/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - SSZipArchive (1.2) + - SSZipArchive (1.6) DEPENDENCIES: - SSZipArchive (from `..`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: ".." SPEC CHECKSUMS: - SSZipArchive: 251093c65f98d6ea282c50bc404bfa631d9fd721 + SSZipArchive: e3560652173f5fe708a835632e63e38b9000bdb7 PODFILE CHECKSUM: 8d38f966bef0580b1feb382672c12ef6a674ea58 -COCOAPODS: 1.0.1 +COCOAPODS: 1.1.0.rc.1 diff --git a/SwiftExample/SwiftExample.xcodeproj/project.pbxproj b/SwiftExample/SwiftExample.xcodeproj/project.pbxproj index 2a02700..412768d 100644 --- a/SwiftExample/SwiftExample.xcodeproj/project.pbxproj +++ b/SwiftExample/SwiftExample.xcodeproj/project.pbxproj @@ -253,13 +253,15 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0800; TargetAttributes = { 8DFE19081BDA74F800709011 = { CreatedOnToolsVersion = 7.1; + LastSwiftMigration = 0800; }; 8DFE191C1BDA74F800709011 = { CreatedOnToolsVersion = 7.1; + LastSwiftMigration = 0800; TestTargetID = 8DFE19081BDA74F800709011; }; }; @@ -374,7 +376,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -483,8 +485,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -528,8 +532,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -548,6 +554,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -562,6 +569,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -574,6 +582,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -585,6 +594,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample"; }; name = Debug; @@ -597,6 +607,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample"; }; name = Release; diff --git a/SwiftExample/SwiftExample/AppDelegate.swift b/SwiftExample/SwiftExample/AppDelegate.swift index d118200..8377f52 100644 --- a/SwiftExample/SwiftExample/AppDelegate.swift +++ b/SwiftExample/SwiftExample/AppDelegate.swift @@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } - func applicationWillResignActive(application: UIApplication) { + func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - func applicationDidEnterBackground(application: UIApplication) { + func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - func applicationWillEnterForeground(application: UIApplication) { + func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - func applicationDidBecomeActive(application: UIApplication) { + func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - func applicationWillTerminate(application: UIApplication) { + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } diff --git a/SwiftExample/SwiftExample/Base.lproj/Main.storyboard b/SwiftExample/SwiftExample/Base.lproj/Main.storyboard index 29d0b74..c808dca 100644 --- a/SwiftExample/SwiftExample/Base.lproj/Main.storyboard +++ b/SwiftExample/SwiftExample/Base.lproj/Main.storyboard @@ -1,9 +1,10 @@ - + - + + @@ -15,50 +16,44 @@ - + - + diff --git a/SwiftExample/SwiftExample/ViewController.swift b/SwiftExample/SwiftExample/ViewController.swift index 42de00f..fdb4fe2 100644 --- a/SwiftExample/SwiftExample/ViewController.swift +++ b/SwiftExample/SwiftExample/ViewController.swift @@ -39,13 +39,13 @@ class ViewController: UIViewController { // MARK: IBAction @IBAction func zipPressed(_: UIButton) { - let sampleDataPath = NSBundle.mainBundle().bundleURL.URLByAppendingPathComponent("Sample Data").path + let sampleDataPath = Bundle.main.bundleURL.appendingPathComponent("Sample Data").path zipPath = tempZipPath() - let success = SSZipArchive.createZipFileAtPath(zipPath!, withContentsOfDirectory: sampleDataPath!) + let success = SSZipArchive.createZipFile(atPath: zipPath!, withContentsOfDirectory: sampleDataPath) if success { - unzipButton.enabled = true - zipButton.enabled = false + unzipButton.isEnabled = true + zipButton.isEnabled = false } } @@ -58,19 +58,19 @@ class ViewController: UIViewController { return } - let success = SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath) + let success = SSZipArchive.unzipFile(atPath: zipPath, toDestination: unzipPath) if !success { return } var items: [String] do { - items = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(unzipPath) + items = try FileManager.default.contentsOfDirectory(atPath: unzipPath) } catch { return } - for (index, item) in items.enumerate() { + for (index, item) in items.enumerated() { switch index { case 0: file1.text = item @@ -83,43 +83,40 @@ class ViewController: UIViewController { } } - unzipButton.enabled = false - resetButton.enabled = true + unzipButton.isEnabled = false + resetButton.isEnabled = true } @IBAction func resetPressed(_: UIButton) { file1.text = "" file2.text = "" file3.text = "" - zipButton.enabled = true - unzipButton.enabled = false - resetButton.enabled = false + zipButton.isEnabled = true + unzipButton.isEnabled = false + resetButton.isEnabled = false } // MARK: Private func tempZipPath() -> String { - var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] - path += "/\(NSUUID().UUIDString).zip" + var path = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true)[0] + path += "/\(UUID().uuidString).zip" return path } func tempUnzipPath() -> String? { - var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] - path += "/\(NSUUID().UUIDString)" - let url = NSURL(fileURLWithPath: path) + var path = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true)[0] + path += "/\(UUID().uuidString)" + let url = URL(fileURLWithPath: path) do { - try NSFileManager.defaultManager().createDirectoryAtURL(url, withIntermediateDirectories: true, attributes: nil) + try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true, attributes: nil) } catch { return nil } - if let path = url.path { - return path - } - return nil + return url.path } } diff --git a/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift b/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift index e726fc3..a27f48a 100644 --- a/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift +++ b/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift @@ -28,7 +28,7 @@ class SwiftExampleTests: XCTestCase { func testPerformanceExample() { // This is an example of a performance test case. - self.measureBlock { + self.measure { // Put the code you want to measure the time of here. } }