diff --git a/Zip/Zip.swift b/Zip/Zip.swift index debb4484455b6d13e24de3ad27ead9640f435fd3..59cc2e500d51858f40684eb63004b618bae56cb4 100644 --- a/Zip/Zip.swift +++ b/Zip/Zip.swift @@ -25,10 +25,12 @@ public enum ZipError: ErrorType { public class Zip { + public init () { + + } + public func unzipFile(path: String, destination: String, overwrite: Bool, password: String?) throws { - guard let zip: zipFile = unzOpen(path) else { - throw ZipError.UnzipError - } + let zip = unzOpen(path) var currentPosition = 0.0 var globalInfo: unz_global_info = unz_global_info(number_entry: 0, number_disk_with_CD: 0, size_comment: 0) unzGetGlobalInfo(zip, &globalInfo) diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj new file mode 100644 index 0000000000000000000000000000000000000000..a5b457d7b58a3f66b2720f39d04e46ab459fa11a --- /dev/null +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -0,0 +1,486 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 3430F6711C45C930007473A6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F6701C45C930007473A6 /* AppDelegate.swift */; }; + 3430F6731C45C930007473A6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F6721C45C930007473A6 /* ViewController.swift */; }; + 3430F6761C45C930007473A6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3430F6741C45C930007473A6 /* Main.storyboard */; }; + 3430F6781C45C930007473A6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3430F6771C45C930007473A6 /* Assets.xcassets */; }; + 3430F67B1C45C930007473A6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3430F6791C45C930007473A6 /* LaunchScreen.storyboard */; }; + 3430F6861C45C930007473A6 /* SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F6851C45C930007473A6 /* SampleTests.swift */; }; + 3430F6991C45C949007473A6 /* Zip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3430F6961C45C93F007473A6 /* Zip.framework */; }; + 3430F69A1C45C949007473A6 /* Zip.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3430F6961C45C93F007473A6 /* Zip.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 3430F69F1C45C96A007473A6 /* master.zip in Resources */ = {isa = PBXBuildFile; fileRef = 3430F69E1C45C96A007473A6 /* master.zip */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 3430F6821C45C930007473A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3430F6651C45C930007473A6 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3430F66C1C45C930007473A6; + remoteInfo = Sample; + }; + 3430F6951C45C93F007473A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3430F6901C45C93F007473A6 /* Zip.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 347E3A741C1DFFB500A11FD3; + remoteInfo = Zip; + }; + 3430F6971C45C93F007473A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3430F6901C45C93F007473A6 /* Zip.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 347E3A7E1C1DFFB500A11FD3; + remoteInfo = ZipTests; + }; + 3430F69B1C45C949007473A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3430F6901C45C93F007473A6 /* Zip.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 347E3A731C1DFFB500A11FD3; + remoteInfo = Zip; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 3430F69D1C45C949007473A6 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3430F69A1C45C949007473A6 /* Zip.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3430F66D1C45C930007473A6 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3430F6701C45C930007473A6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 3430F6721C45C930007473A6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 3430F6751C45C930007473A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 3430F6771C45C930007473A6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 3430F67A1C45C930007473A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 3430F67C1C45C930007473A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3430F6811C45C930007473A6 /* SampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3430F6851C45C930007473A6 /* SampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleTests.swift; sourceTree = ""; }; + 3430F6871C45C930007473A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3430F6901C45C93F007473A6 /* Zip.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Zip.xcodeproj; path = ../../Zip.xcodeproj; sourceTree = ""; }; + 3430F69E1C45C96A007473A6 /* master.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = master.zip; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3430F66A1C45C930007473A6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3430F6991C45C949007473A6 /* Zip.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3430F67E1C45C930007473A6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3430F6641C45C930007473A6 = { + isa = PBXGroup; + children = ( + 3430F6901C45C93F007473A6 /* Zip.xcodeproj */, + 3430F66F1C45C930007473A6 /* Sample */, + 3430F6841C45C930007473A6 /* SampleTests */, + 3430F66E1C45C930007473A6 /* Products */, + ); + sourceTree = ""; + }; + 3430F66E1C45C930007473A6 /* Products */ = { + isa = PBXGroup; + children = ( + 3430F66D1C45C930007473A6 /* Sample.app */, + 3430F6811C45C930007473A6 /* SampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 3430F66F1C45C930007473A6 /* Sample */ = { + isa = PBXGroup; + children = ( + 3430F6701C45C930007473A6 /* AppDelegate.swift */, + 3430F6721C45C930007473A6 /* ViewController.swift */, + 3430F69E1C45C96A007473A6 /* master.zip */, + 3430F6741C45C930007473A6 /* Main.storyboard */, + 3430F6771C45C930007473A6 /* Assets.xcassets */, + 3430F6791C45C930007473A6 /* LaunchScreen.storyboard */, + 3430F67C1C45C930007473A6 /* Info.plist */, + ); + path = Sample; + sourceTree = ""; + }; + 3430F6841C45C930007473A6 /* SampleTests */ = { + isa = PBXGroup; + children = ( + 3430F6851C45C930007473A6 /* SampleTests.swift */, + 3430F6871C45C930007473A6 /* Info.plist */, + ); + path = SampleTests; + sourceTree = ""; + }; + 3430F6911C45C93F007473A6 /* Products */ = { + isa = PBXGroup; + children = ( + 3430F6961C45C93F007473A6 /* Zip.framework */, + 3430F6981C45C93F007473A6 /* ZipTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3430F66C1C45C930007473A6 /* Sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3430F68A1C45C930007473A6 /* Build configuration list for PBXNativeTarget "Sample" */; + buildPhases = ( + 3430F6691C45C930007473A6 /* Sources */, + 3430F66A1C45C930007473A6 /* Frameworks */, + 3430F66B1C45C930007473A6 /* Resources */, + 3430F69D1C45C949007473A6 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 3430F69C1C45C949007473A6 /* PBXTargetDependency */, + ); + name = Sample; + productName = Sample; + productReference = 3430F66D1C45C930007473A6 /* Sample.app */; + productType = "com.apple.product-type.application"; + }; + 3430F6801C45C930007473A6 /* SampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3430F68D1C45C930007473A6 /* Build configuration list for PBXNativeTarget "SampleTests" */; + buildPhases = ( + 3430F67D1C45C930007473A6 /* Sources */, + 3430F67E1C45C930007473A6 /* Frameworks */, + 3430F67F1C45C930007473A6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3430F6831C45C930007473A6 /* PBXTargetDependency */, + ); + name = SampleTests; + productName = SampleTests; + productReference = 3430F6811C45C930007473A6 /* SampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3430F6651C45C930007473A6 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 0720; + ORGANIZATIONNAME = "Roy Marmelstein"; + TargetAttributes = { + 3430F66C1C45C930007473A6 = { + CreatedOnToolsVersion = 7.2; + }; + 3430F6801C45C930007473A6 = { + CreatedOnToolsVersion = 7.2; + TestTargetID = 3430F66C1C45C930007473A6; + }; + }; + }; + buildConfigurationList = 3430F6681C45C930007473A6 /* Build configuration list for PBXProject "Sample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3430F6641C45C930007473A6; + productRefGroup = 3430F66E1C45C930007473A6 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 3430F6911C45C93F007473A6 /* Products */; + ProjectRef = 3430F6901C45C93F007473A6 /* Zip.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 3430F66C1C45C930007473A6 /* Sample */, + 3430F6801C45C930007473A6 /* SampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 3430F6961C45C93F007473A6 /* Zip.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Zip.framework; + remoteRef = 3430F6951C45C93F007473A6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3430F6981C45C93F007473A6 /* ZipTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ZipTests.xctest; + remoteRef = 3430F6971C45C93F007473A6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 3430F66B1C45C930007473A6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3430F67B1C45C930007473A6 /* LaunchScreen.storyboard in Resources */, + 3430F6781C45C930007473A6 /* Assets.xcassets in Resources */, + 3430F6761C45C930007473A6 /* Main.storyboard in Resources */, + 3430F69F1C45C96A007473A6 /* master.zip in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3430F67F1C45C930007473A6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3430F6691C45C930007473A6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3430F6731C45C930007473A6 /* ViewController.swift in Sources */, + 3430F6711C45C930007473A6 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3430F67D1C45C930007473A6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3430F6861C45C930007473A6 /* SampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 3430F6831C45C930007473A6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3430F66C1C45C930007473A6 /* Sample */; + targetProxy = 3430F6821C45C930007473A6 /* PBXContainerItemProxy */; + }; + 3430F69C1C45C949007473A6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Zip; + targetProxy = 3430F69B1C45C949007473A6 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 3430F6741C45C930007473A6 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3430F6751C45C930007473A6 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 3430F6791C45C930007473A6 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3430F67A1C45C930007473A6 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 3430F6881C45C930007473A6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 3430F6891C45C930007473A6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3430F68B1C45C930007473A6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + INFOPLIST_FILE = Sample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 3430F68C1C45C930007473A6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + INFOPLIST_FILE = Sample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 3430F68E1C45C930007473A6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = SampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.SampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample"; + }; + name = Debug; + }; + 3430F68F1C45C930007473A6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = SampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.SampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3430F6681C45C930007473A6 /* Build configuration list for PBXProject "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3430F6881C45C930007473A6 /* Debug */, + 3430F6891C45C930007473A6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3430F68A1C45C930007473A6 /* Build configuration list for PBXNativeTarget "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3430F68B1C45C930007473A6 /* Debug */, + 3430F68C1C45C930007473A6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 3430F68D1C45C930007473A6 /* Build configuration list for PBXNativeTarget "SampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3430F68E1C45C930007473A6 /* Debug */, + 3430F68F1C45C930007473A6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3430F6651C45C930007473A6 /* Project object */; +} diff --git a/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000000000000000000000000000000000..a80c038249587c0ccbc024376cd198dd085201ab --- /dev/null +++ b/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/examples/Sample/Sample/AppDelegate.swift b/examples/Sample/Sample/AppDelegate.swift new file mode 100644 index 0000000000000000000000000000000000000000..da5ce4925c56b12afb07bbdb579507152528325b --- /dev/null +++ b/examples/Sample/Sample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// Sample +// +// Created by Roy Marmelstein on 13/01/2016. +// Copyright © 2016 Roy Marmelstein. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } + + 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) { + // 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) { + // 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) { + // 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) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/examples/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..118c98f7461bf98b2bc7e061150d8021121ad277 --- /dev/null +++ b/examples/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/Sample/Sample/Base.lproj/LaunchScreen.storyboard b/examples/Sample/Sample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..78686cd0750147943119cbb75ad038eb1579fe3f --- /dev/null +++ b/examples/Sample/Sample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Sample/Sample/Base.lproj/Main.storyboard b/examples/Sample/Sample/Base.lproj/Main.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..3a2a49bad8c615d719f891998e537cd29a001ec0 --- /dev/null +++ b/examples/Sample/Sample/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Sample/Sample/Info.plist b/examples/Sample/Sample/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..6905cc67bbf738499f2accb4b56f5f1ddc8ce444 --- /dev/null +++ b/examples/Sample/Sample/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/examples/Sample/Sample/ViewController.swift b/examples/Sample/Sample/ViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..471374e446dee63b6af42240af1f2f80b3ef87e4 --- /dev/null +++ b/examples/Sample/Sample/ViewController.swift @@ -0,0 +1,74 @@ +// +// ViewController.swift +// Sample +// +// Created by Roy Marmelstein on 13/01/2016. +// Copyright © 2016 Roy Marmelstein. All rights reserved. +// + +import UIKit +import Zip + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + do { + let destinationPath = tempUnzipPath()! + let fileAbsoluteUrl = NSBundle.mainBundle().pathForResource("master", ofType: "zip") + let fileManager = NSFileManager.defaultManager() + let fileExists = fileManager.fileExistsAtPath(fileAbsoluteUrl!) + try Zip().unzipFile(fileAbsoluteUrl!, destination: destinationPath, overwrite: true, password: nil) + } + catch { + print("oops") + } + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + func tempCopyPath() -> String? { + var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] + path += "master.zip" + let url = NSURL(fileURLWithPath: path) + + do { + try NSFileManager.defaultManager().createDirectoryAtURL(url, withIntermediateDirectories: true, attributes: nil) + } catch { + return nil + } + + if let path = url.path { + return path + } + + return nil + } + + + + func tempUnzipPath() -> String? { + var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] + path += "/\(NSUUID().UUIDString)" + let url = NSURL(fileURLWithPath: path) + + do { + try NSFileManager.defaultManager().createDirectoryAtURL(url, withIntermediateDirectories: true, attributes: nil) + } catch { + return nil + } + + if let path = url.path { + return path + } + + return nil + } + +} + diff --git a/examples/Sample/Sample/master.zip b/examples/Sample/Sample/master.zip new file mode 100644 index 0000000000000000000000000000000000000000..96e2d453dd67d621da39661bb46496df30a6db63 Binary files /dev/null and b/examples/Sample/Sample/master.zip differ diff --git a/examples/Sample/SampleTests/Info.plist b/examples/Sample/SampleTests/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..ba72822e8728ef2951005e49b6c27a2f1da6572d --- /dev/null +++ b/examples/Sample/SampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/examples/Sample/SampleTests/SampleTests.swift b/examples/Sample/SampleTests/SampleTests.swift new file mode 100644 index 0000000000000000000000000000000000000000..e2939801ceb5b392aadbd91a8fe2aad64100add2 --- /dev/null +++ b/examples/Sample/SampleTests/SampleTests.swift @@ -0,0 +1,36 @@ +// +// SampleTests.swift +// SampleTests +// +// Created by Roy Marmelstein on 13/01/2016. +// Copyright © 2016 Roy Marmelstein. All rights reserved. +// + +import XCTest +@testable import Sample + +class SampleTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock { + // Put the code you want to measure the time of here. + } + } + +}