diff --git a/Armchair.xcodeproj/project.pbxproj b/Armchair.xcodeproj/project.pbxproj index ea545e6..e4b55d4 100644 --- a/Armchair.xcodeproj/project.pbxproj +++ b/Armchair.xcodeproj/project.pbxproj @@ -9,13 +9,13 @@ /* Begin PBXBuildFile section */ E6D8B8F119C756A4001AD043 /* Armchair.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Armchair.swift */; }; E6D8B8F419C756A4001AD043 /* Armchair.h in Headers */ = {isa = PBXBuildFile; fileRef = F8111E3819A95C8B0040E7D1 /* Armchair.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E6D8B92D19C880A9001AD043 /* ArmchairTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D8B92C19C880A9001AD043 /* ArmchairTests.swift */; }; F8111E3919A95C8B0040E7D1 /* Armchair.h in Headers */ = {isa = PBXBuildFile; fileRef = F8111E3819A95C8B0040E7D1 /* Armchair.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F8111E6119A9674D0040E7D1 /* ArmchairTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5C19A9674D0040E7D1 /* ArmchairTests.swift */; }; F897FF4119AA800700AB5182 /* Armchair.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Armchair.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - F8111E6519A967880040E7D1 /* PBXContainerItemProxy */ = { + E6D8B93119C880AE001AD043 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = F8111E2A19A95C8B0040E7D1 /* Project object */; proxyType = 1; @@ -26,12 +26,12 @@ /* Begin PBXFileReference section */ E6D8B8B519C7274F001AD043 /* Armchair.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Armchair.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E6D8B8B619C7274F001AD043 /* ArmchairTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ArmchairTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - E6D8B8F919C756A4001AD043 /* ArmchairMac.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ArmchairMac.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E6D8B8F919C756A4001AD043 /* Armchair.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Armchair.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E6D8B92819C880A9001AD043 /* ArmchairTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ArmchairTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + E6D8B92B19C880A9001AD043 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E6D8B92C19C880A9001AD043 /* ArmchairTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArmchairTests.swift; sourceTree = ""; }; F8111E3719A95C8B0040E7D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F8111E3819A95C8B0040E7D1 /* Armchair.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Armchair.h; sourceTree = ""; }; - F8111E4119A95C8B0040E7D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F8111E5C19A9674D0040E7D1 /* ArmchairTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArmchairTests.swift; sourceTree = ""; }; F897FF4019AA800700AB5182 /* Armchair.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Armchair.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -43,6 +43,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + E6D8B92519C880A9001AD043 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; F8111E2F19A95C8B0040E7D1 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -50,24 +57,34 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F8111E3B19A95C8B0040E7D1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + E6D8B92919C880A9001AD043 /* Tests */ = { + isa = PBXGroup; + children = ( + E6D8B92C19C880A9001AD043 /* ArmchairTests.swift */, + E6D8B92A19C880A9001AD043 /* Supporting Files */, + ); + path = Tests; + sourceTree = ""; + }; + E6D8B92A19C880A9001AD043 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E6D8B92B19C880A9001AD043 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; F8111E2919A95C8B0040E7D1 = { isa = PBXGroup; children = ( F8111E3519A95C8B0040E7D1 /* Source */, - F8111E3F19A95C8B0040E7D1 /* Tests */, + E6D8B92919C880A9001AD043 /* Tests */, E6D8B8B519C7274F001AD043 /* Armchair.framework */, - E6D8B8F919C756A4001AD043 /* ArmchairMac.framework */, - E6D8B8B619C7274F001AD043 /* ArmchairTests.xctest */, + E6D8B8F919C756A4001AD043 /* Armchair.framework */, + E6D8B92819C880A9001AD043 /* ArmchairTests.xctest */, ); sourceTree = ""; }; @@ -89,23 +106,6 @@ name = "Supporting Files"; sourceTree = ""; }; - F8111E3F19A95C8B0040E7D1 /* Tests */ = { - isa = PBXGroup; - children = ( - F8111E5C19A9674D0040E7D1 /* ArmchairTests.swift */, - F8111E4019A95C8B0040E7D1 /* Supporting Files */, - ); - path = Tests; - sourceTree = ""; - }; - F8111E4019A95C8B0040E7D1 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - F8111E4119A95C8B0040E7D1 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -143,9 +143,27 @@ ); name = ArmchairMac; productName = Armchair; - productReference = E6D8B8F919C756A4001AD043 /* ArmchairMac.framework */; + productReference = E6D8B8F919C756A4001AD043 /* Armchair.framework */; productType = "com.apple.product-type.framework"; }; + E6D8B92719C880A9001AD043 /* ArmchairTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E6D8B92E19C880A9001AD043 /* Build configuration list for PBXNativeTarget "ArmchairTests" */; + buildPhases = ( + E6D8B92419C880A9001AD043 /* Sources */, + E6D8B92519C880A9001AD043 /* Frameworks */, + E6D8B92619C880A9001AD043 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + E6D8B93219C880AE001AD043 /* PBXTargetDependency */, + ); + name = ArmchairTests; + productName = ArmchairTests; + productReference = E6D8B92819C880A9001AD043 /* ArmchairTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; F8111E3219A95C8B0040E7D1 /* Armchair */ = { isa = PBXNativeTarget; buildConfigurationList = F8111E4619A95C8B0040E7D1 /* Build configuration list for PBXNativeTarget "Armchair" */; @@ -164,37 +182,19 @@ productReference = E6D8B8B519C7274F001AD043 /* Armchair.framework */; productType = "com.apple.product-type.framework"; }; - F8111E3D19A95C8B0040E7D1 /* ArmchairTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F8111E4919A95C8B0040E7D1 /* Build configuration list for PBXNativeTarget "ArmchairTests" */; - buildPhases = ( - F8111E3A19A95C8B0040E7D1 /* Sources */, - F8111E3B19A95C8B0040E7D1 /* Frameworks */, - F8111E3C19A95C8B0040E7D1 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - F8111E6619A967880040E7D1 /* PBXTargetDependency */, - ); - name = ArmchairTests; - productName = ArmchairTests; - productReference = E6D8B8B619C7274F001AD043 /* ArmchairTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ F8111E2A19A95C8B0040E7D1 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastUpgradeCheck = 0610; ORGANIZATIONNAME = Armchair; TargetAttributes = { - F8111E3219A95C8B0040E7D1 = { + E6D8B92719C880A9001AD043 = { CreatedOnToolsVersion = 6.0; }; - F8111E3D19A95C8B0040E7D1 = { + F8111E3219A95C8B0040E7D1 = { CreatedOnToolsVersion = 6.0; }; }; @@ -213,7 +213,7 @@ targets = ( F8111E3219A95C8B0040E7D1 /* Armchair */, E6D8B8EF19C756A4001AD043 /* ArmchairMac */, - F8111E3D19A95C8B0040E7D1 /* ArmchairTests */, + E6D8B92719C880A9001AD043 /* ArmchairTests */, ); }; /* End PBXProject section */ @@ -226,14 +226,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F8111E3119A95C8B0040E7D1 /* Resources */ = { + E6D8B92619C880A9001AD043 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - F8111E3C19A95C8B0040E7D1 /* Resources */ = { + F8111E3119A95C8B0040E7D1 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -251,6 +251,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + E6D8B92419C880A9001AD043 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E6D8B92D19C880A9001AD043 /* ArmchairTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F8111E2E19A95C8B0040E7D1 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -259,21 +267,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F8111E3A19A95C8B0040E7D1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F8111E6119A9674D0040E7D1 /* ArmchairTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - F8111E6619A967880040E7D1 /* PBXTargetDependency */ = { + E6D8B93219C880AE001AD043 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = F8111E3219A95C8B0040E7D1 /* Armchair */; - targetProxy = F8111E6519A967880040E7D1 /* PBXContainerItemProxy */; + targetProxy = E6D8B93119C880AE001AD043 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -282,6 +282,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -291,10 +292,12 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 7.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_NAME = ArmchairMac; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; + PRODUCT_NAME = Armchair; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -303,6 +306,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -312,10 +316,44 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 7.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_NAME = ArmchairMac; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; + PRODUCT_NAME = Armchair; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; + }; + name = Release; + }; + E6D8B92F19C880A9001AD043 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + E6D8B93019C880A9001AD043 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; @@ -355,6 +393,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OTHER_SWIFT_FLAGS = "-DDebug"; @@ -396,6 +435,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -415,10 +455,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -433,40 +474,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - }; - name = Release; - }; - F8111E4A19A95C8B0040E7D1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - F8111E4B19A95C8B0040E7D1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = ""; }; name = Release; }; @@ -482,6 +494,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + E6D8B92E19C880A9001AD043 /* Build configuration list for PBXNativeTarget "ArmchairTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E6D8B92F19C880A9001AD043 /* Debug */, + E6D8B93019C880A9001AD043 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; F8111E2D19A95C8B0040E7D1 /* Build configuration list for PBXProject "Armchair" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -500,15 +521,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - F8111E4919A95C8B0040E7D1 /* Build configuration list for PBXNativeTarget "ArmchairTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F8111E4A19A95C8B0040E7D1 /* Debug */, - F8111E4B19A95C8B0040E7D1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = F8111E2A19A95C8B0040E7D1 /* Project object */; diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m index 24a3f92..a51fcb7 100644 --- a/Example/AppDelegate.m +++ b/Example/AppDelegate.m @@ -8,9 +8,14 @@ #import "AppDelegate.h" +@import Armchair; + +//#import "Armchair-Bridging-Header.h" + @interface AppDelegate () @property (weak) IBOutlet NSWindow *window; + @end @implementation AppDelegate diff --git a/Example/Base.lproj/Main.storyboard b/Example/Base.lproj/Main.storyboard index 509da12..ba0f08d 100644 --- a/Example/Base.lproj/Main.storyboard +++ b/Example/Base.lproj/Main.storyboard @@ -18,7 +18,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/Example/Base.lproj/MainMenu.xib b/Example/Base.lproj/MainMenu.xib index 933177d..26e19a9 100644 --- a/Example/Base.lproj/MainMenu.xib +++ b/Example/Base.lproj/MainMenu.xib @@ -1,7 +1,8 @@ - + - + + @@ -10,12 +11,8 @@ - - - - - - + + @@ -666,15 +663,119 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Images.xcassets/LaunchImage.launchimage/Contents.json b/Example/Images.xcassets/LaunchImage.launchimage/Contents.json index 6f870a4..5a29666 100644 --- a/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/Example/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -2,46 +2,44 @@ "images" : [ { "orientation" : "portrait", - "idiom" : "iphone", + "idiom" : "ipad", + "minimum-system-version" : "7.0", "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", "minimum-system-version" : "7.0", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", + "minimum-system-version" : "7.0", "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "ipad", - "extent" : "full-screen", "minimum-system-version" : "7.0", + "extent" : "full-screen", "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" } ], "info" : { diff --git a/Example/Images.xcassets/chair.imageset/Contents.json b/Example/Images.xcassets/chair.imageset/Contents.json deleted file mode 100644 index 8f08acb..0000000 --- a/Example/Images.xcassets/chair.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "chair.jpg" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "chair-1.jpg" - }, - { - "idiom" : "universal", - "scale" : "3x", - "filename" : "chair-2.jpg" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/Images.xcassets/chair.imageset/chair-2.jpg b/Example/Images.xcassets/chair.imageset/chair-2.jpg deleted file mode 100644 index 53310fa..0000000 Binary files a/Example/Images.xcassets/chair.imageset/chair-2.jpg and /dev/null differ diff --git a/Example/Images.xcassets/chair.imageset/chair.jpg b/Example/Images.xcassets/chair.imageset/chair.jpg deleted file mode 100644 index 53310fa..0000000 Binary files a/Example/Images.xcassets/chair.imageset/chair.jpg and /dev/null differ diff --git a/Example/Info-iOS.plist b/Example/Info-iOS.plist index 1bd5b8d..65447a8 100644 --- a/Example/Info-iOS.plist +++ b/Example/Info-iOS.plist @@ -6,6 +6,10 @@ en CFBundleExecutable $(EXECUTABLE_NAME) + CFBundleIcons + + CFBundleIcons~ipad + CFBundleIdentifier com.armchair.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion diff --git a/Example/Images.xcassets/chair.imageset/chair-1.jpg b/Example/armchair.jpg similarity index 100% rename from Example/Images.xcassets/chair.imageset/chair-1.jpg rename to Example/armchair.jpg diff --git a/Example/icon.png b/Example/icon.png new file mode 100644 index 0000000..ba1240d Binary files /dev/null and b/Example/icon.png differ diff --git a/Mac Example.xcodeproj/project.pbxproj b/Mac Example.xcodeproj/project.pbxproj index 029f9b7..f8aef92 100644 --- a/Mac Example.xcodeproj/project.pbxproj +++ b/Mac Example.xcodeproj/project.pbxproj @@ -7,23 +7,65 @@ objects = { /* Begin PBXBuildFile section */ - E6D8B8CD19C75292001AD043 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E6D8B8CC19C75292001AD043 /* main.m */; }; - E6D8B8D019C75292001AD043 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E6D8B8CF19C75292001AD043 /* AppDelegate.m */; }; - E6D8B8D219C75292001AD043 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E6D8B8D119C75292001AD043 /* Images.xcassets */; }; - E6D8B8D519C75292001AD043 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E6D8B8D319C75292001AD043 /* MainMenu.xib */; }; - E6D8B91F19C75857001AD043 /* ArmchairMac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6D8B91E19C75857001AD043 /* ArmchairMac.framework */; }; + E671B64619C8D6CB00851BFD /* Armchair.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6631F6E19C8CA5C00F5F4EA /* Armchair.framework */; }; + E6BB678A19C8D1720031C112 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E6BB678119C8D1720031C112 /* AppDelegate.m */; }; + E6BB678C19C8D1720031C112 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E6BB678519C8D1720031C112 /* MainMenu.xib */; }; + E6BB678F19C8D1720031C112 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E6BB678919C8D1720031C112 /* main.m */; }; + E6E5F4C519C8E1A4008A6C1B /* armchair.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4C419C8E1A4008A6C1B /* armchair.jpg */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + E6631F6B19C8CA5C00F5F4EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E6D8B8B519C7274F001AD043; + remoteInfo = Armchair; + }; + E6631F6D19C8CA5C00F5F4EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E6D8B8F919C756A4001AD043; + remoteInfo = ArmchairMac; + }; + E6631F6F19C8CA5C00F5F4EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E6D8B92819C880A9001AD043; + remoteInfo = ArmchairTests; + }; + E6E5F4BC19C8DFA3008A6C1B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = E6D8B8EF19C756A4001AD043; + remoteInfo = ArmchairMac; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + E6631F7319C8CAF200F5F4EA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ + E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Armchair.xcodeproj; sourceTree = ""; }; + E6BB678019C8D1720031C112 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = ""; }; + E6BB678119C8D1720031C112 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Example/AppDelegate.m; sourceTree = ""; }; + E6BB678619C8D1720031C112 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = MainMenu.xib; sourceTree = ""; }; + E6BB678819C8D1720031C112 /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Info-Mac.plist"; path = "Example/Info-Mac.plist"; sourceTree = ""; }; + E6BB678919C8D1720031C112 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; E6D8B8C719C75292001AD043 /* Mac Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mac Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - E6D8B8CB19C75292001AD043 /* Info-Mac.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = "Info-Mac.plist"; path = "Example/Info-Mac.plist"; sourceTree = ""; }; - E6D8B8CC19C75292001AD043 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; - E6D8B8CE19C75292001AD043 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = ""; }; - E6D8B8CF19C75292001AD043 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Example/AppDelegate.m; sourceTree = ""; }; - E6D8B8D119C75292001AD043 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = ""; }; - E6D8B8D419C75292001AD043 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - E6D8B8ED19C75565001AD043 /* Armchair.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Armchair.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Armchair-evfkxrlmesanplcgvhiqbnaxdagl/Build/Products/Debug-iphoneos/Armchair.framework"; sourceTree = ""; }; - E6D8B91E19C75857001AD043 /* ArmchairMac.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ArmchairMac.framework; path = build/Debug/ArmchairMac.framework; sourceTree = ""; }; + E6E5F4C419C8E1A4008A6C1B /* armchair.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = armchair.jpg; path = Example/armchair.jpg; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -31,53 +73,53 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E6D8B91F19C75857001AD043 /* ArmchairMac.framework in Frameworks */, + E671B64619C8D6CB00851BFD /* Armchair.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - E6D8B8BE19C75292001AD043 = { + E6631F6619C8CA5C00F5F4EA /* Products */ = { isa = PBXGroup; children = ( - E6D8B91E19C75857001AD043 /* ArmchairMac.framework */, - E6D8B8ED19C75565001AD043 /* Armchair.framework */, - E6D8B8C919C75292001AD043 /* Source */, - E6D8B8C819C75292001AD043 /* Products */, - ); - sourceTree = ""; - }; - E6D8B8C819C75292001AD043 /* Products */ = { - isa = PBXGroup; - children = ( - E6D8B8C719C75292001AD043 /* Mac Example.app */, + E6631F6C19C8CA5C00F5F4EA /* Armchair.framework */, + E6631F6E19C8CA5C00F5F4EA /* Armchair.framework */, + E6631F7019C8CA5C00F5F4EA /* ArmchairTests.xctest */, ); name = Products; sourceTree = ""; }; - E6D8B8C919C75292001AD043 /* Source */ = { + E6BB679019C8D1800031C112 /* Source */ = { isa = PBXGroup; children = ( - E6D8B8CE19C75292001AD043 /* AppDelegate.h */, - E6D8B8CF19C75292001AD043 /* AppDelegate.m */, - E6D8B8D119C75292001AD043 /* Images.xcassets */, - E6D8B8D319C75292001AD043 /* MainMenu.xib */, - E6D8B8CA19C75292001AD043 /* Supporting Files */, + E6BB678019C8D1720031C112 /* AppDelegate.h */, + E6BB678119C8D1720031C112 /* AppDelegate.m */, + E6BB678519C8D1720031C112 /* MainMenu.xib */, + E6BB679119C8D1AB0031C112 /* Supporting Files */, ); name = Source; - path = "Mac Example"; sourceTree = ""; }; - E6D8B8CA19C75292001AD043 /* Supporting Files */ = { + E6BB679119C8D1AB0031C112 /* Supporting Files */ = { isa = PBXGroup; children = ( - E6D8B8CB19C75292001AD043 /* Info-Mac.plist */, - E6D8B8CC19C75292001AD043 /* main.m */, + E6E5F4C419C8E1A4008A6C1B /* armchair.jpg */, + E6BB678819C8D1720031C112 /* Info-Mac.plist */, + E6BB678919C8D1720031C112 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; + E6D8B8BE19C75292001AD043 = { + isa = PBXGroup; + children = ( + E6BB679019C8D1800031C112 /* Source */, + E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */, + E6D8B8C719C75292001AD043 /* Mac Example.app */, + ); + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -88,10 +130,12 @@ E6D8B8C319C75292001AD043 /* Sources */, E6D8B8C419C75292001AD043 /* Frameworks */, E6D8B8C519C75292001AD043 /* Resources */, + E6631F7319C8CAF200F5F4EA /* CopyFiles */, ); buildRules = ( ); dependencies = ( + E6E5F4BD19C8DFA3008A6C1B /* PBXTargetDependency */, ); name = "Mac Example"; productName = "Mac Example"; @@ -121,8 +165,14 @@ Base, ); mainGroup = E6D8B8BE19C75292001AD043; - productRefGroup = E6D8B8C819C75292001AD043 /* Products */; + productRefGroup = E6D8B8BE19C75292001AD043; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = E6631F6619C8CA5C00F5F4EA /* Products */; + ProjectRef = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + }, + ); projectRoot = ""; targets = ( E6D8B8C619C75292001AD043 /* Mac Example */, @@ -130,13 +180,37 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + E6631F6C19C8CA5C00F5F4EA /* Armchair.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Armchair.framework; + remoteRef = E6631F6B19C8CA5C00F5F4EA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E6631F6E19C8CA5C00F5F4EA /* Armchair.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Armchair.framework; + remoteRef = E6631F6D19C8CA5C00F5F4EA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E6631F7019C8CA5C00F5F4EA /* ArmchairTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ArmchairTests.xctest; + remoteRef = E6631F6F19C8CA5C00F5F4EA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ E6D8B8C519C75292001AD043 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - E6D8B8D219C75292001AD043 /* Images.xcassets in Resources */, - E6D8B8D519C75292001AD043 /* MainMenu.xib in Resources */, + E6E5F4C519C8E1A4008A6C1B /* armchair.jpg in Resources */, + E6BB678C19C8D1720031C112 /* MainMenu.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -147,21 +221,29 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - E6D8B8D019C75292001AD043 /* AppDelegate.m in Sources */, - E6D8B8CD19C75292001AD043 /* main.m in Sources */, + E6BB678F19C8D1720031C112 /* main.m in Sources */, + E6BB678A19C8D1720031C112 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + E6E5F4BD19C8DFA3008A6C1B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ArmchairMac; + targetProxy = E6E5F4BC19C8DFA3008A6C1B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ - E6D8B8D319C75292001AD043 /* MainMenu.xib */ = { + E6BB678519C8D1720031C112 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - E6D8B8D419C75292001AD043 /* Base */, + E6BB678619C8D1720031C112 /* Base */, ); name = MainMenu.xib; - path = Example; + path = Example/Base.lproj; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -246,8 +328,8 @@ E6D8B8E519C75292001AD043 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/build/Debug", @@ -262,8 +344,8 @@ E6D8B8E619C75292001AD043 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/build/Debug", diff --git a/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme b/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme index 1f09266..ce14201 100644 --- a/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme +++ b/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme @@ -1,6 +1,6 @@ Mac Example.xcscheme orderHint - 3 + 1 SuppressBuildableAutocreation diff --git a/Source/Armchair.swift b/Source/Armchair.swift index aa97a1b..f93e83f 100644 --- a/Source/Armchair.swift +++ b/Source/Armchair.swift @@ -23,7 +23,14 @@ import Foundation import StoreKit import SystemConfiguration + +#if os(iOS) import UIKit +#elseif os(OSX) +import Appkit +#else + // Not yet supported +#endif // MARK: - // MARK: PUBLIC Interface @@ -288,7 +295,10 @@ public func debugEnabled(debugEnabled: Bool) { #if Debug Manager.defaultManager.debugEnabled = debugEnabled #else - println("[Armchair] Debug is disabled on release builds. If you really want to enable debug mode, add \"DEBUG=1\" to your release Preprocessor Macros") + println("[Armchair] Debug is disabled on release builds.") + println("[Armchair] If you really want to enable debug mode,") + println("[Armchair] add \"-DDebug\" to your Swift Compiler - Custom Flags") + println("[Armchair] section in the target's build settings for release") #endif } @@ -611,7 +621,12 @@ public enum ArmchairKey: String, Printable { public var description : String { get { +#if os(iOS) return self.toRaw() +#elseif os(OSX) + return self.rawValue +#else +#endif } } } @@ -658,15 +673,19 @@ public class ArmchairManager : NSObject, NSAlertDelegate { } public class Manager : ArmchairManager { - private var iOSVersion = NSString(string: UIDevice.currentDevice().systemVersion).doubleValue - +#if os(iOS) + private var operatingSystemVersion = NSString(string: UIDevice.currentDevice().systemVersion).doubleValue +#elseif os(OSX) + private var operatingSystemVersion = Double(NSProcessInfo.processInfo().operatingSystemVersion.majorVersion) +#else +#endif + // MARK: - // MARK: Review Alert & Properties #if os(iOS) private var ratingAlert: UIAlertView? = nil -// private let reviewURLTemplate = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE" - private let reviewURLTemplate = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&id=APP_ID&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE" + private let reviewURLTemplate = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&id=APP_ID&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE" #elseif os(OSX) private var ratingAlert: NSAlert? = nil private let reviewURLTemplate = "macappstore://itunes.apple.com/us/app/idAPP_ID?ls=1&mt=12&at=AFFILIATE_CODE&ct=AFFILIATE_CAMPAIGN_CODE" @@ -772,7 +791,7 @@ public class Manager : ArmchairManager { private lazy var opensInStoreKit: Bool = self.defaultOpensInStoreKit() private func defaultOpensInStoreKit() -> Bool { - return iOSVersion >= 8 + return operatingSystemVersion >= 8 } #endif @@ -919,14 +938,14 @@ public class Manager : ArmchairManager { var timeInterval: Double? = userDefaultsObject?.doubleForKey(firstUseDateKey) if 0 == timeInterval { timeInterval = NSDate().timeIntervalSince1970 - userDefaultsObject?.setObject(NSNumber.numberWithDouble(timeInterval!), forKey: firstUseDateKey) + userDefaultsObject?.setObject(NSNumber(double: timeInterval!), forKey: firstUseDateKey) } // Increment the key's count var incrementKeyCount = userDefaultsObject?.integerForKey(incrementKey) userDefaultsObject?.setInteger(++incrementKeyCount!, forKey:incrementKey) - debugLog("Incremented \(incrementKeyType) count: \(incrementKeyCount)") + debugLog("Incremented \(incrementKeyType): \(incrementKeyCount!)") } else if tracksNewVersions { // it's a new version of the app, so restart tracking @@ -935,12 +954,14 @@ public class Manager : ArmchairManager { userDefaultsObject?.setObject(userDefaultsObject?.objectForKey(keyForArmchairKeyType(ArmchairKey.DeclinedToRate)), forKey: keyForArmchairKeyType(ArmchairKey.PreviousVersionDeclinedToRate)) userDefaultsObject?.setObject(currentVersion, forKey: currentVersionKey) - userDefaultsObject?.setObject(NSNumber.numberWithDouble(NSDate().timeIntervalSince1970), forKey: keyForArmchairKeyType(ArmchairKey.FirstUseDate)) - userDefaultsObject?.setObject(NSNumber.numberWithInteger(1), forKey: keyForArmchairKeyType(ArmchairKey.UseCount)) - userDefaultsObject?.setObject(NSNumber.numberWithInteger(0), forKey: keyForArmchairKeyType(ArmchairKey.SignificantEventCount)) - userDefaultsObject?.setObject(NSNumber.numberWithBool(false), forKey: keyForArmchairKeyType(ArmchairKey.RatedCurrentVersion)) - userDefaultsObject?.setObject(NSNumber.numberWithBool(false), forKey: keyForArmchairKeyType(ArmchairKey.DeclinedToRate)) - userDefaultsObject?.setObject(NSNumber.numberWithDouble(0), forKey: keyForArmchairKeyType(ArmchairKey.ReminderRequestDate)) + userDefaultsObject?.setObject(NSNumber(double: NSDate().timeIntervalSince1970), forKey: keyForArmchairKeyType(ArmchairKey.FirstUseDate)) + userDefaultsObject?.setObject(NSNumber(integer: 1), forKey: keyForArmchairKeyType(ArmchairKey.UseCount)) + userDefaultsObject?.setObject(NSNumber(integer: 0), forKey: keyForArmchairKeyType(ArmchairKey.SignificantEventCount)) + userDefaultsObject?.setObject(NSNumber(bool: false), forKey: keyForArmchairKeyType(ArmchairKey.RatedCurrentVersion)) + userDefaultsObject?.setObject(NSNumber(bool: false), forKey: keyForArmchairKeyType(ArmchairKey.DeclinedToRate)) + userDefaultsObject?.setObject(NSNumber(double: 0), forKey: keyForArmchairKeyType(ArmchairKey.ReminderRequestDate)) + + debugLog("Reset Tracking Version to: \(trackingVersion!)") } userDefaultsObject?.synchronize() @@ -1095,7 +1116,7 @@ public class Manager : ArmchairManager { private func showRatingAlert() { #if os(iOS) - if iOSVersion >= 8 && usesAlertController { + if operatingSystemVersion >= 8 && usesAlertController { /* iOS 8 uses new UIAlertController API*/ var alertView : UIAlertController = UIAlertController(title: reviewTitle, message: reviewMessage, preferredStyle: UIAlertControllerStyle.Alert) alertView.addAction(UIAlertAction(title: cancelButtonTitle, style:UIAlertActionStyle.Cancel, handler: { @@ -1143,28 +1164,26 @@ public class Manager : ArmchairManager { } #elseif os(OSX) -// NSAlert *alert = [NSAlert alertWithMessageText:self.reviewTitle -// defaultButton:self.rateButtonTitle -// alternateButton:self.cancelButtonTitle -// otherButton:self.remindButtonTitle -// informativeTextWithFormat:@"%@",self.reviewMessage]; -// self.ratingAlert = alert; -// -// NSWindow *window = [[NSApplication sharedApplication] keyWindow]; -// if (window) { -// [alert beginSheetModalForWindow:[[NSApplication sharedApplication] keyWindow] -// modalDelegate:self -// didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) -// contextInfo:nil]; -// } else { -// NSInteger returnCode = [alert runModal]; -// [self handleNSAlertReturnCode:returnCode]; -// } -// -// if (self.didDisplayAlertBlock) -// self.didDisplayAlertBlock(); + + var alert: NSAlert = NSAlert() + alert.messageText = reviewTitle + alert.informativeText = reviewMessage + alert.addButtonWithTitle(rateButtonTitle) + alert.addButtonWithTitle(remindButtonTitle) + alert.addButtonWithTitle(cancelButtonTitle) + ratingAlert = alert + + if let window = NSApplication.sharedApplication().keyWindow { + alert.beginSheetModalForWindow(window, modalDelegate: self, didEndSelector: "alertDidEnd:returnCode:", contextInfo: nil) + } else { + var returnCode = alert.runModal() + handleNSAlertReturnCode(returnCode) + } + + if let closure = self.didDisplayAlertClosure { + closure() + } #else - println("OMG, it's that mythical new Apple product!!!") #endif } @@ -1225,10 +1244,12 @@ public class Manager : ArmchairManager { case NSAlertOtherReturn: // remind them later remindMeLater() + default: + return } } - private func alertDidEnd(alert: NSAlert, returnCode: NSInteger, contextInfo: void) { + private func alertDidEnd(alert: NSAlert, returnCode: NSInteger) { handleNSAlertReturnCode(returnCode) } @@ -1274,7 +1295,7 @@ public class Manager : ArmchairManager { if let appIDInt = appIDVal { var productParameters: [NSObject:AnyObject]! = [SKStoreProductParameterITunesItemIdentifier : NSNumber(integer: appIDInt)] - if (iOSVersion >= 8) { + if (operatingSystemVersion >= 8) { productParameters[SKStoreProductParameterAffiliateToken] = affiliateCode productParameters[SKStoreProductParameterCampaignToken] = affiliateCampaignCode } @@ -1302,7 +1323,8 @@ public class Manager : ArmchairManager { //Use the standard openUrl method } else { - UIApplication.sharedApplication().openURL(NSURL(string: reviewURLString())) + let url = NSURL(string: reviewURLString()) + UIApplication.sharedApplication().openURL(url) } if UIDevice.currentDevice().model.rangeOfString("Simulator") != nil { @@ -1313,7 +1335,7 @@ public class Manager : ArmchairManager { debugLog(" - Or try copy/pasting \(fakeURL) into a browser on your computer.") } #elseif os(OSX) - NSWorkspace.sharedWorkspace().openURL(NSURL(reviewURLString)) + NSWorkspace.sharedWorkspace().openURL(NSURL(string: reviewURLString())) #else #endif } @@ -1457,7 +1479,7 @@ public class Manager : ArmchairManager { } } - userDefaultsObject?.setObject(NSNumber.numberWithBool(true), forKey: appiraterAlreadyCompletedKey) + userDefaultsObject?.setObject(NSNumber(bool: true), forKey: appiraterAlreadyCompletedKey) userDefaultsObject?.synchronize() } @@ -1492,7 +1514,7 @@ public class Manager : ArmchairManager { } } - userDefaultsObject?.setObject(NSNumber.numberWithBool(true), forKey: appReviewManagerAlreadyCompletedKey) + userDefaultsObject?.setObject(NSNumber(bool: true), forKey: appReviewManagerAlreadyCompletedKey) userDefaultsObject?.synchronize() } @@ -1531,16 +1553,8 @@ public class Manager : ArmchairManager { if useMainAppBundleForLocalizations { bundle = NSBundle.mainBundle() } else { - // These bundles are exactly the same, but splitting them by target makes Cocoapods happy. -#if os(iOS) - let armchairBundleURL: NSURL? = NSBundle.mainBundle().URLForResource("Armchair-iOS", withExtension: "bundle") -#elseif os(OSX) - let armchairBundleURL: NSURL? = NSBundle.mainBundle().URLForResource("Armchair-OSX", withExtension: "bundle") -#else - let armchairBundleURL: NSURL? = nil -#endif + let armchairBundleURL: NSURL? = NSBundle.mainBundle().URLForResource("Armchair", withExtension: "bundle") if let url = armchairBundleURL { - // Armchair-[iOS|OSX].bundle will likely only exist when used via CocoaPods bundle = NSBundle(URL: url) } else { bundle = NSBundle.mainBundle() @@ -1603,8 +1617,8 @@ public class Manager : ArmchairManager { alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false) } #elseif os(OSX) - NSApp.endSheet(window: NSApplication.sharedApplication().keyWindow) -#else + NSApp.endSheet(NSApplication.sharedApplication().keyWindow) + #else #endif ratingAlert = nil } diff --git a/Tests/ArmchairTests.swift b/Tests/ArmchairTests.swift index cf6aba3..b8365b7 100644 --- a/Tests/ArmchairTests.swift +++ b/Tests/ArmchairTests.swift @@ -1,30 +1,16 @@ -// ParameterEncodingTests.swift // -// Copyright (c) 2014 Armchair (http://github.com/UrbanApps/Armchair) +// ArmchairTests.swift +// ArmchairTests // -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: +// Created by Matt Coneybeare on 9/16/14. +// Copyright (c) 2014 Armchair. All rights reserved. // -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -import Foundation -import Armchair +import UIKit import XCTest +import Armchair -class ArmchairTestCase: XCTestCase { +class ArmchairTests: XCTestCase { var appID: String! = "987654321" @@ -33,9 +19,20 @@ class ArmchairTestCase: XCTestCase { Armchair.appID(appID) } + // MARK: - func testAppIDSetProperly() { - XCTAssertEqual(Armchair.appID(), appID, "appID should be as set") + XCTAssertEqual(Armchair.appID, appID, "appID should be as set") } + + // Need to figure out a way to get the test suite to load the correct info.plist bundle for the test app +// func testAppNameReadFromBundleCorrectly() { +// XCTAssertEqual(Armchair.appName(), "Armchair Tests") +// } + + func testAppNameNotNil() { + XCTAssertNotNil(Armchair.appName(), "appName should never be nil") + } + } diff --git a/Tests/Info.plist b/Tests/Info.plist index d71ae81..d7fd4b1 100644 --- a/Tests/Info.plist +++ b/Tests/Info.plist @@ -20,5 +20,7 @@ ???? CFBundleVersion 1 + CFBundleDisplayName + Armchair Tests diff --git a/iOS Example.xcodeproj/project.pbxproj b/iOS Example.xcodeproj/project.pbxproj index 125f4c9..9ecf4d2 100644 --- a/iOS Example.xcodeproj/project.pbxproj +++ b/iOS Example.xcodeproj/project.pbxproj @@ -8,10 +8,12 @@ /* Begin PBXBuildFile section */ E6D8B8EC19C75559001AD043 /* Armchair.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6D8B8BB19C7382B001AD043 /* Armchair.framework */; }; + E6E5F4C319C8E18E008A6C1B /* armchair.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4C219C8E18E008A6C1B /* armchair.jpg */; }; + E6E5F4CD19C8E388008A6C1B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4CC19C8E388008A6C1B /* Icon.png */; }; + E6E5F4CF19C8E3C6008A6C1B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4CE19C8E3C6008A6C1B /* Images.xcassets */; }; F8111E0B19A951050040E7D1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E0A19A951050040E7D1 /* AppDelegate.swift */; }; F8111E0D19A951050040E7D1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E0C19A951050040E7D1 /* ViewController.swift */; }; F8111E1219A951050040E7D1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8111E1019A951050040E7D1 /* Main.storyboard */; }; - F8111E1419A951050040E7D1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8111E1319A951050040E7D1 /* Images.xcassets */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -36,6 +38,13 @@ remoteGlobalIDString = E6D8B8B619C7274F001AD043; remoteInfo = ArmchairTests; }; + E6E5F4C019C8E156008A6C1B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F8111E4E19A95D7C0040E7D1 /* Armchair.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E6D8B8F919C756A4001AD043; + remoteInfo = ArmchairMac; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -53,11 +62,13 @@ /* Begin PBXFileReference section */ E6C49DC519C23C91006A4544 /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + E6E5F4C219C8E18E008A6C1B /* armchair.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = armchair.jpg; sourceTree = ""; }; + E6E5F4CC19C8E388008A6C1B /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + E6E5F4CE19C8E3C6008A6C1B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; F8111E0919A951050040E7D1 /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; F8111E0A19A951050040E7D1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; F8111E0C19A951050040E7D1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; F8111E1119A951050040E7D1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - F8111E1319A951050040E7D1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; F8111E4E19A95D7C0040E7D1 /* Armchair.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Armchair.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ @@ -77,6 +88,7 @@ isa = PBXGroup; children = ( E6D8B8BB19C7382B001AD043 /* Armchair.framework */, + E6E5F4C119C8E156008A6C1B /* Armchair.framework */, E6D8B8BD19C7382B001AD043 /* ArmchairTests.xctest */, ); name = Products; @@ -97,7 +109,6 @@ F8111E0A19A951050040E7D1 /* AppDelegate.swift */, F8111E0C19A951050040E7D1 /* ViewController.swift */, F8111E1019A951050040E7D1 /* Main.storyboard */, - F8111E1319A951050040E7D1 /* Images.xcassets */, F8111E0819A951050040E7D1 /* Supporting Files */, ); name = Source; @@ -107,6 +118,9 @@ F8111E0819A951050040E7D1 /* Supporting Files */ = { isa = PBXGroup; children = ( + E6E5F4CE19C8E3C6008A6C1B /* Images.xcassets */, + E6E5F4CC19C8E388008A6C1B /* Icon.png */, + E6E5F4C219C8E18E008A6C1B /* armchair.jpg */, F8111E0919A951050040E7D1 /* Info-iOS.plist */, ); name = "Supporting Files"; @@ -187,6 +201,13 @@ remoteRef = E6D8B8BC19C7382B001AD043 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + E6E5F4C119C8E156008A6C1B /* Armchair.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Armchair.framework; + remoteRef = E6E5F4C019C8E156008A6C1B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -194,8 +215,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + E6E5F4C319C8E18E008A6C1B /* armchair.jpg in Resources */, + E6E5F4CF19C8E3C6008A6C1B /* Images.xcassets in Resources */, F8111E1219A951050040E7D1 /* Main.storyboard in Resources */, - F8111E1419A951050040E7D1 /* Images.xcassets in Resources */, + E6E5F4CD19C8E388008A6C1B /* Icon.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; };