Skip to content

Commit 92d6f8e

Browse files
committed
Merge branch 'swift3.0'
# Conflicts: # Zip/ZipUtilities.swift
2 parents 7437d31 + bcb5d05 commit 92d6f8e

24 files changed

+306
-341
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# MacOS
2+
.DS_Store
13
# Xcode
24
#
35
build/

.swift-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0

.travis.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
osx_image: xcode7.2
1+
osx_image: xcode8
22
language: objective-c
33
env:
44
global:
55
- LC_CTYPE=en_US.UTF-8
66
- LANG=en_US.UTF-8
77
before_install:
8-
- brew update || brew update
9-
- brew outdated xctool || brew upgrade xctool
10-
- gem install cocoapods
11-
- xcrun simctl list
8+
- gem install cocoapods --pre
129
install: echo "<3"
1310
env:
1411
- MODE=framework

README.md

+1-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
![Zip - Zip and unzip files in Swift](https://cloud.githubusercontent.com/assets/889949/12374908/252373d0-bcac-11e5-8ece-6933aeae8222.png)
22

33
[![Build Status](https://travis-ci.org/marmelroy/Zip.svg?branch=master)](https://travis-ci.org/marmelroy/Zip) [![Version](http://img.shields.io/cocoapods/v/Zip.svg)](http://cocoapods.org/?q=Zip)
4-
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
54

65
# Zip
76
A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of [minizip](https://github.com/nmoinvaz/minizip).
@@ -58,26 +57,8 @@ Zip supports '.zip' and '.cbz' files out of the box. To support additional zip-d
5857
Zip.addCustomFileExtension("file-extension-here")
5958
```
6059

61-
62-
### Setting up with Carthage
63-
64-
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
65-
66-
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
67-
68-
```bash
69-
$ brew update
70-
$ brew install carthage
71-
```
72-
73-
To integrate Format into your Xcode project using Carthage, specify it in your `Cartfile`:
74-
75-
```ogdl
76-
github "marmelroy/Zip"
77-
```
78-
7960
### Setting up with [CocoaPods](http://cocoapods.org/?q=Zip)
8061
```ruby
8162
source 'https://github.com/CocoaPods/Specs.git'
82-
pod 'Zip', '~> 0.4'
63+
pod 'Zip', '~> 0.5', :submodules => true
8364
```

Zip copy-Info.plist

-26
This file was deleted.

Zip.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = "Zip"
11-
s.version = "0.4.3"
11+
s.version = "0.5"
1212
s.summary = "Zip and unzip files in Swift."
1313

1414
# This description is used to generate tags and improve search results.

Zip.xcodeproj/project.pbxproj

+21-15
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133

134134
/* Begin PBXFileReference section */
135135
342545B51CE525B200336074 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
136-
342545B61CE525B300336074 /* Zip copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Zip copy-Info.plist"; path = "/Users/marmelroy/Documents/Projects/OpenSource/Zip/Zip copy-Info.plist"; sourceTree = "<absolute>"; };
137136
342FC0D21C5044DC0023A3C3 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
138137
342FC0D31C5044DC0023A3C3 /* aes_via_ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_via_ace.h; sourceTree = "<group>"; };
139138
342FC0D41C5044DC0023A3C3 /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = "<group>"; };
@@ -275,7 +274,6 @@
275274
347E3A761C1DFFB500A11FD3 /* Zip */,
276275
347E3A821C1DFFB500A11FD3 /* ZipTests */,
277276
347E3A751C1DFFB500A11FD3 /* Products */,
278-
342545B61CE525B300336074 /* Zip copy-Info.plist */,
279277
);
280278
sourceTree = "<group>";
281279
};
@@ -493,7 +491,7 @@
493491
isa = PBXProject;
494492
attributes = {
495493
LastSwiftUpdateCheck = 0720;
496-
LastUpgradeCheck = 0720;
494+
LastUpgradeCheck = 0800;
497495
ORGANIZATIONNAME = "Roy Marmelstein";
498496
TargetAttributes = {
499497
343F50FE1C8DAEEC0028C434 = {
@@ -504,9 +502,11 @@
504502
};
505503
347E3A731C1DFFB500A11FD3 = {
506504
CreatedOnToolsVersion = 7.2;
505+
LastSwiftMigration = 0800;
507506
};
508507
347E3A7D1C1DFFB500A11FD3 = {
509508
CreatedOnToolsVersion = 7.2;
509+
LastSwiftMigration = 0800;
510510
};
511511
};
512512
};
@@ -677,9 +677,9 @@
677677
CLANG_ENABLE_MODULES = YES;
678678
DEFINES_MODULE = YES;
679679
DYLIB_COMPATIBILITY_VERSION = 1;
680-
DYLIB_CURRENT_VERSION = 7;
680+
DYLIB_CURRENT_VERSION = 8;
681681
DYLIB_INSTALL_NAME_BASE = "@rpath";
682-
INFOPLIST_FILE = "Zip copy-Info.plist";
682+
INFOPLIST_FILE = "Zip/Info-tvOS.plist";
683683
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
684684
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
685685
LIBRARY_SEARCH_PATHS = "$(inherited)";
@@ -702,9 +702,9 @@
702702
CLANG_ENABLE_MODULES = YES;
703703
DEFINES_MODULE = YES;
704704
DYLIB_COMPATIBILITY_VERSION = 1;
705-
DYLIB_CURRENT_VERSION = 7;
705+
DYLIB_CURRENT_VERSION = 8;
706706
DYLIB_INSTALL_NAME_BASE = "@rpath";
707-
INFOPLIST_FILE = "Zip copy-Info.plist";
707+
INFOPLIST_FILE = "Zip/Info-tvOS.plist";
708708
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
709709
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
710710
LIBRARY_SEARCH_PATHS = "$(inherited)";
@@ -714,6 +714,7 @@
714714
SKIP_INSTALL = YES;
715715
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
716716
SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**";
717+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
717718
TARGETED_DEVICE_FAMILY = 3;
718719
TVOS_DEPLOYMENT_TARGET = 9.0;
719720
};
@@ -724,10 +725,10 @@
724725
buildSettings = {
725726
CODE_SIGN_IDENTITY = "-";
726727
COMBINE_HIDPI_IMAGES = YES;
727-
CURRENT_PROJECT_VERSION = 7;
728+
CURRENT_PROJECT_VERSION = 8;
728729
DEFINES_MODULE = YES;
729730
DYLIB_COMPATIBILITY_VERSION = 1;
730-
DYLIB_CURRENT_VERSION = 7;
731+
DYLIB_CURRENT_VERSION = 8;
731732
DYLIB_INSTALL_NAME_BASE = "@rpath";
732733
FRAMEWORK_VERSION = A;
733734
INFOPLIST_FILE = Zip/Info.plist;
@@ -747,10 +748,10 @@
747748
buildSettings = {
748749
CODE_SIGN_IDENTITY = "-";
749750
COMBINE_HIDPI_IMAGES = YES;
750-
CURRENT_PROJECT_VERSION = 7;
751+
CURRENT_PROJECT_VERSION = 8;
751752
DEFINES_MODULE = YES;
752753
DYLIB_COMPATIBILITY_VERSION = 1;
753-
DYLIB_CURRENT_VERSION = 7;
754+
DYLIB_CURRENT_VERSION = 8;
754755
DYLIB_INSTALL_NAME_BASE = "@rpath";
755756
FRAMEWORK_VERSION = A;
756757
INFOPLIST_FILE = Zip/Info.plist;
@@ -762,6 +763,7 @@
762763
SDKROOT = macosx;
763764
SKIP_INSTALL = YES;
764765
SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**";
766+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
765767
};
766768
name = Release;
767769
};
@@ -812,7 +814,7 @@
812814
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
813815
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
814816
COPY_PHASE_STRIP = NO;
815-
CURRENT_PROJECT_VERSION = 7;
817+
CURRENT_PROJECT_VERSION = 8;
816818
DEBUG_INFORMATION_FORMAT = dwarf;
817819
ENABLE_STRICT_OBJC_MSGSEND = YES;
818820
ENABLE_TESTABILITY = YES;
@@ -835,6 +837,7 @@
835837
ONLY_ACTIVE_ARCH = YES;
836838
SDKROOT = iphoneos;
837839
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
840+
SWIFT_VERSION = 3.0;
838841
TARGETED_DEVICE_FAMILY = "1,2";
839842
VERSIONING_SYSTEM = "apple-generic";
840843
VERSION_INFO_PREFIX = "";
@@ -860,7 +863,7 @@
860863
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
861864
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
862865
COPY_PHASE_STRIP = NO;
863-
CURRENT_PROJECT_VERSION = 7;
866+
CURRENT_PROJECT_VERSION = 8;
864867
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
865868
ENABLE_NS_ASSERTIONS = NO;
866869
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -875,6 +878,7 @@
875878
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
876879
MTL_ENABLE_DEBUG_INFO = NO;
877880
SDKROOT = iphoneos;
881+
SWIFT_VERSION = 3.0;
878882
TARGETED_DEVICE_FAMILY = "1,2";
879883
VALIDATE_PRODUCT = YES;
880884
VERSIONING_SYSTEM = "apple-generic";
@@ -889,7 +893,7 @@
889893
CLANG_ENABLE_MODULES = YES;
890894
DEFINES_MODULE = YES;
891895
DYLIB_COMPATIBILITY_VERSION = 1;
892-
DYLIB_CURRENT_VERSION = 7;
896+
DYLIB_CURRENT_VERSION = 8;
893897
DYLIB_INSTALL_NAME_BASE = "@rpath";
894898
INFOPLIST_FILE = Zip/Info.plist;
895899
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -911,7 +915,7 @@
911915
CLANG_ENABLE_MODULES = YES;
912916
DEFINES_MODULE = YES;
913917
DYLIB_COMPATIBILITY_VERSION = 1;
914-
DYLIB_CURRENT_VERSION = 7;
918+
DYLIB_CURRENT_VERSION = 8;
915919
DYLIB_INSTALL_NAME_BASE = "@rpath";
916920
INFOPLIST_FILE = Zip/Info.plist;
917921
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -922,6 +926,7 @@
922926
PRODUCT_NAME = "$(TARGET_NAME)";
923927
SKIP_INSTALL = YES;
924928
SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**";
929+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
925930
};
926931
name = Release;
927932
};
@@ -942,6 +947,7 @@
942947
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
943948
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.ZipTests;
944949
PRODUCT_NAME = "$(TARGET_NAME)";
950+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
945951
};
946952
name = Release;
947953
};

Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Zip.xcodeproj/xcshareddata/xcschemes/Zip tvOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Zip.xcodeproj/xcshareddata/xcschemes/Zip.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Zip.xcodeproj/xcshareddata/xcschemes/ZipTests.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Zip/Info-tvOS.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.4.1</string>
18+
<string>0.5.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>6</string>
22+
<string>8</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

Zip/Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.4.3</string>
18+
<string>0.5.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>7</string>
22+
<string>8</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

Zip/QuickZip.swift

+21-16
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension Zip {
2121

2222
- returns: NSURL of the destination folder.
2323
*/
24-
public class func quickUnzipFile(path: NSURL) throws -> NSURL {
24+
public class func quickUnzipFile(_ path: URL) throws -> URL {
2525
return try quickUnzipFile(path, progress: nil)
2626
}
2727

@@ -37,16 +37,21 @@ extension Zip {
3737

3838
- returns: NSURL of the destination folder.
3939
*/
40-
public class func quickUnzipFile(path: NSURL, progress: ((progress: Double) -> ())?) throws -> NSURL {
41-
let fileManager = NSFileManager.defaultManager()
42-
guard let fileExtension = path.pathExtension, let fileName = path.lastPathComponent else {
43-
throw ZipError.UnzipFail
40+
public class func quickUnzipFile(_ path: URL, progress: ((_ progress: Double) -> ())?) throws -> URL {
41+
let fileManager = FileManager.default
42+
43+
let fileExtension = path.pathExtension
44+
let fileName = path.lastPathComponent
45+
46+
let directoryName = fileName.replacingOccurrences(of: ".\(fileExtension)", with: "")
47+
let documentsUrl = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL
48+
do {
49+
let destinationUrl = documentsUrl.appendingPathComponent(directoryName, isDirectory: true)
50+
try self.unzipFile(path, destination: destinationUrl, overwrite: true, password: nil, progress: progress)
51+
return destinationUrl
52+
}catch{
53+
throw(ZipError.unzipFail)
4454
}
45-
let directoryName = fileName.stringByReplacingOccurrencesOfString(".\(fileExtension)", withString: "")
46-
let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
47-
let destinationUrl = documentsUrl.URLByAppendingPathComponent(directoryName, isDirectory: true)
48-
try self.unzipFile(path, destination: destinationUrl, overwrite: true, password: nil, progress: progress)
49-
return destinationUrl
5055
}
5156

5257
//MARK: Quick Zip
@@ -63,7 +68,7 @@ extension Zip {
6368

6469
- returns: NSURL of the destination folder.
6570
*/
66-
public class func quickZipFiles(paths: [NSURL], fileName: String) throws -> NSURL {
71+
public class func quickZipFiles(_ paths: [URL], fileName: String) throws -> URL {
6772
return try quickZipFiles(paths, fileName: fileName, progress: nil)
6873
}
6974

@@ -80,13 +85,13 @@ extension Zip {
8085

8186
- returns: NSURL of the destination folder.
8287
*/
83-
public class func quickZipFiles(paths: [NSURL], fileName: String, progress: ((progress: Double) -> ())?) throws -> NSURL {
84-
let fileManager = NSFileManager.defaultManager()
85-
let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
86-
let destinationUrl = documentsUrl.URLByAppendingPathComponent("\(fileName).zip")
88+
public class func quickZipFiles(_ paths: [URL], fileName: String, progress: ((_ progress: Double) -> ())?) throws -> URL {
89+
let fileManager = FileManager.default
90+
let documentsUrl = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL
91+
let destinationUrl = documentsUrl.appendingPathComponent("\(fileName).zip")
8792
try self.zipFiles(paths, zipFilePath: destinationUrl, password: nil, progress: progress)
8893
return destinationUrl
8994
}
9095

9196

92-
}
97+
}

0 commit comments

Comments
 (0)