Swift 4 and tweaks to example projects

This commit is contained in:
Matt Coneybeare
2017-09-14 20:40:16 -04:00
parent 87d68ec2a7
commit dfb230dcd2
8 changed files with 128 additions and 83 deletions

View File

@@ -318,13 +318,16 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0700; LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800; LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Armchair; ORGANIZATIONNAME = Armchair;
TargetAttributes = { TargetAttributes = {
E6A0AF6419C9CFF400C3A7DC = { E6A0AF6419C9CFF400C3A7DC = {
CreatedOnToolsVersion = 6.0; CreatedOnToolsVersion = 6.0;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
}; };
E6D8B8EF19C756A4001AD043 = {
LastSwiftMigration = 0900;
};
F8111E3219A95C8B0040E7D1 = { F8111E3219A95C8B0040E7D1 = {
CreatedOnToolsVersion = 6.0; CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800; LastSwiftMigration = 0800;
@@ -541,7 +544,8 @@
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@@ -566,7 +570,8 @@
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };
@@ -617,14 +622,20 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -655,6 +666,7 @@
OTHER_SWIFT_FLAGS = "-DDebug"; OTHER_SWIFT_FLAGS = "-DDebug";
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
@@ -669,14 +681,20 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -698,6 +716,7 @@
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
@@ -724,7 +743,7 @@
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@@ -746,7 +765,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0800" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
<TestableReference <TestableReference
@@ -55,6 +56,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0800" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
@@ -36,6 +37,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View File

@@ -28,12 +28,13 @@
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
AppDelegate.setupArmchair()
return true return true
} }
} }
let Pages = "361309726" // Pages iOS let appID = "361309726" // Pages iOS
#elseif os(OSX) #elseif os(OSX)
@@ -43,9 +44,12 @@
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow! @IBOutlet weak var window: NSWindow!
override init() {
AppDelegate.setupArmchair()
}
} }
let Pages = "409201541" // Pages Mac let appID = "409201541" // Pages Mac
#else #else
#endif #endif
@@ -54,10 +58,6 @@ import Armchair
extension AppDelegate { extension AppDelegate {
override class func initialize() {
AppDelegate.setupArmchair()
}
class func setupArmchair() { class func setupArmchair() {
// Normally, all the setup would be here. // Normally, all the setup would be here.
// But, because we are presenting a few different setups in the example, // But, because we are presenting a few different setups in the example,
@@ -68,7 +68,7 @@ extension AppDelegate {
// because it needs to receive application life-cycle notifications // because it needs to receive application life-cycle notifications
// //
// NOTE: The appID call always has to go before any other Armchair calls // NOTE: The appID call always has to go before any other Armchair calls
Armchair.appID(Pages) Armchair.appID(appID)
Armchair.debugEnabled(true) Armchair.debugEnabled(true)
} }
} }

View File

@@ -78,7 +78,7 @@ extension ViewController {
resetAppReviewManager() resetAppReviewManager()
// The AppID is the only required setup // The AppID is the only required setup
Armchair.appID(Pages) Armchair.appID(appID)
// Debug means that it will popup on the next available change // Debug means that it will popup on the next available change
Armchair.debugEnabled(true) Armchair.debugEnabled(true)
@@ -96,7 +96,7 @@ extension ViewController {
resetAppReviewManager() resetAppReviewManager()
// The AppID is the only required setup // The AppID is the only required setup
Armchair.appID(Pages) Armchair.appID(appID)
// Debug means that it will popup on the next available change // Debug means that it will popup on the next available change
Armchair.debugEnabled(true) Armchair.debugEnabled(true)
@@ -193,7 +193,7 @@ extension ViewController {
resetAppReviewManager() resetAppReviewManager()
// The AppID is the only required setup // The AppID is the only required setup
Armchair.appID(Pages) Armchair.appID(appID)
// Debug means that it will popup on the next available change // Debug means that it will popup on the next available change
Armchair.debugEnabled(true) Armchair.debugEnabled(true)
@@ -220,7 +220,7 @@ extension ViewController {
#if os(iOS) #if os(iOS)
UIApplication.shared.openURL(url) UIApplication.shared.openURL(url)
#elseif os(OSX) #elseif os(OSX)
NSWorkspace.sharedWorkspace().openURL(url) NSWorkspace.shared.open(url)
#else #else
#endif #endif
} }

View File

@@ -33,13 +33,6 @@
remoteGlobalIDString = E6D8B8F919C756A4001AD043; remoteGlobalIDString = E6D8B8F919C756A4001AD043;
remoteInfo = ArmchairMac; remoteInfo = ArmchairMac;
}; };
E60FA80119C90D3500179D70 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = E6D8B92819C880A9001AD043;
remoteInfo = ArmchairTests;
};
E60FA80319C90D7100179D70 /* PBXContainerItemProxy */ = { E60FA80319C90D7100179D70 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */; containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */;
@@ -135,7 +128,6 @@
E60FA80019C90D3500179D70 /* Armchair.framework */, E60FA80019C90D3500179D70 /* Armchair.framework */,
E6F6156919C9FE8900C0B51C /* Armchair.bundle */, E6F6156919C9FE8900C0B51C /* Armchair.bundle */,
E6F6159819CA003600C0B51C /* Armchair.bundle */, E6F6159819CA003600C0B51C /* Armchair.bundle */,
E60FA80219C90D3500179D70 /* ArmchairTests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -169,7 +161,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0700; LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700; LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Armchair; ORGANIZATIONNAME = Armchair;
TargetAttributes = { TargetAttributes = {
E60FA7B919C908FE00179D70 = { E60FA7B919C908FE00179D70 = {
@@ -216,13 +208,6 @@
remoteRef = E60FA7FF19C90D3500179D70 /* PBXContainerItemProxy */; remoteRef = E60FA7FF19C90D3500179D70 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR; sourceTree = BUILT_PRODUCTS_DIR;
}; };
E60FA80219C90D3500179D70 /* ArmchairTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = ArmchairTests.xctest;
remoteRef = E60FA80119C90D3500179D70 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
E6F6156919C9FE8900C0B51C /* Armchair.bundle */ = { E6F6156919C9FE8900C0B51C /* Armchair.bundle */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = wrapper.cfbundle; fileType = wrapper.cfbundle;
@@ -300,13 +285,21 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
@@ -315,6 +308,7 @@
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
@@ -332,6 +326,7 @@
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@@ -343,13 +338,21 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
@@ -358,6 +361,7 @@
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -367,6 +371,8 @@
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };

View File

@@ -69,18 +69,6 @@ public func reviewTitle(_ reviewTitle: String) {
Manager.defaultManager.reviewTitle = reviewTitle Manager.defaultManager.reviewTitle = reviewTitle
} }
/*
* If set to true, use SKStoreReviewController's requestReview() prompt instead of the default prompt.
* If not on iOS 10.3+, reort to the default prompt.
* Default => false.
*/
public func useStoreKitReviewPrompt() -> Bool {
return Manager.defaultManager.useStoreKitReviewPrompt
}
public func useStoreKitReviewPrompt(_ useStoreKitReviewPrompt: Bool) {
Manager.defaultManager.useStoreKitReviewPrompt = useStoreKitReviewPrompt
}
/* /*
* Get/Set the message to use on the review prompt. * Get/Set the message to use on the review prompt.
* Default value is a localized * Default value is a localized
@@ -292,6 +280,20 @@ public func affiliateCampaignCode(_ affiliateCampaignCode: String) {
Manager.defaultManager.affiliateCampaignCode = affiliateCampaignCode Manager.defaultManager.affiliateCampaignCode = affiliateCampaignCode
} }
#if os(iOS)
/*
* If set to true, use SKStoreReviewController's requestReview() prompt instead of the default prompt.
* If not on iOS 10.3+, reort to the default prompt.
* Default => false.
*/
public func useStoreKitReviewPrompt() -> Bool {
return Manager.defaultManager.useStoreKitReviewPrompt
}
public func useStoreKitReviewPrompt(_ useStoreKitReviewPrompt: Bool) {
Manager.defaultManager.useStoreKitReviewPrompt = useStoreKitReviewPrompt
}
#endif
/* /*
* 'true' will show the Armchair alert everytime. Useful for testing * 'true' will show the Armchair alert everytime. Useful for testing
* how your message looks and making sure the link to your app's review page works. * how your message looks and making sure the link to your app's review page works.
@@ -1241,7 +1243,7 @@ open class Manager : ArmchairManager {
// get the top most controller (= the StoreKit Controller) and dismiss it // get the top most controller (= the StoreKit Controller) and dismiss it
if let presentingController = UIApplication.shared.keyWindow?.rootViewController { if let presentingController = UIApplication.shared.keyWindow?.rootViewController {
if let topController = Manager.topMostViewController(presentingController) { if let topController = Manager.topMostViewController(presentingController) {
topController.present(alertView, animated: usesAnimation) { [weak self] _ in topController.present(alertView, animated: usesAnimation) { [weak self] in
if let closure = self?.didDisplayAlertClosure { if let closure = self?.didDisplayAlertClosure {
closure() closure()
} }
@@ -1284,14 +1286,14 @@ open class Manager : ArmchairManager {
alert.addButton(withTitle: cancelButtonTitle) alert.addButton(withTitle: cancelButtonTitle)
ratingAlert = alert ratingAlert = alert
if let window = NSApplication.shared().keyWindow { if let window = NSApplication.shared.keyWindow {
alert.beginSheetModal(for: window) { alert.beginSheetModal(for: window) {
(response: NSModalResponse) in (response: NSApplication.ModalResponse) in
self.handleNSAlert(returnCode: response) self.handleNSAlertResponse(response)
} }
} else { } else {
let returnCode = alert.runModal() let response = alert.runModal()
handleNSAlert(returnCode:returnCode) handleNSAlertResponse(response)
} }
if let closure = self.didDisplayAlertClosure { if let closure = self.didDisplayAlertClosure {
@@ -1349,24 +1351,24 @@ open class Manager : ArmchairManager {
#elseif os(OSX) #elseif os(OSX)
private func handleNSAlert(returnCode: NSInteger) { private func handleNSAlertResponse(_ response: NSApplication.ModalResponse) {
switch (returnCode) { switch (response) {
case NSAlertFirstButtonReturn: case .alertFirstButtonReturn:
// they want to rate it // they want to rate it
_rateApp() _rateApp()
case NSAlertSecondButtonReturn: case .alertSecondButtonReturn:
// remind them later or cancel // remind them later or cancel
if showsRemindButton() { if showsRemindButton() {
remindMeLater() remindMeLater()
} else { } else {
dontRate() dontRate()
} }
case NSAlertThirdButtonReturn: case .alertThirdButtonReturn:
// they don't want to rate it // they don't want to rate it
dontRate() dontRate()
default: default:
return return
} }
} }
#else #else
@@ -1449,7 +1451,7 @@ open class Manager : ArmchairManager {
#elseif os(OSX) #elseif os(OSX)
if let url = URL(string: reviewURLString()) { if let url = URL(string: reviewURLString()) {
let opened = NSWorkspace.shared().open(url) let opened = NSWorkspace.shared.open(url)
if !opened { if !opened {
debugLog("Failed to open \(url)") debugLog("Failed to open \(url)")
} }
@@ -1754,7 +1756,7 @@ open class Manager : ArmchairManager {
alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: false) alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: false)
} }
#elseif os(OSX) #elseif os(OSX)
if let window = NSApplication.shared().keyWindow { if let window = NSApplication.shared.keyWindow {
if let parent = window.sheetParent { if let parent = window.sheetParent {
parent.endSheet(window) parent.endSheet(window)
} }
@@ -1777,12 +1779,12 @@ open class Manager : ArmchairManager {
// MARK: - // MARK: -
// MARK: Notification Handlers // MARK: Notification Handlers
public func appWillResignActive(_ notification: Notification) { @objc public func appWillResignActive(_ notification: Notification) {
debugLog("appWillResignActive:") debugLog("appWillResignActive:")
hideRatingAlert() hideRatingAlert()
} }
public func applicationDidFinishLaunching(_ notification: Notification) { @objc public func applicationDidFinishLaunching(_ notification: Notification) {
DispatchQueue.global(qos: .background).async { DispatchQueue.global(qos: .background).async {
self.debugLog("applicationDidFinishLaunching:") self.debugLog("applicationDidFinishLaunching:")
self.migrateKeysIfNecessary() self.migrateKeysIfNecessary()
@@ -1790,7 +1792,7 @@ open class Manager : ArmchairManager {
} }
} }
public func applicationWillEnterForeground(_ notification: Notification) { @objc public func applicationWillEnterForeground(_ notification: Notification) {
DispatchQueue.global(qos: .background).async { DispatchQueue.global(qos: .background).async {
self.debugLog("applicationWillEnterForeground:") self.debugLog("applicationWillEnterForeground:")
self.migrateKeysIfNecessary() self.migrateKeysIfNecessary()
@@ -1818,12 +1820,12 @@ open class Manager : ArmchairManager {
fileprivate func setupNotifications() { fileprivate func setupNotifications() {
#if os(iOS) #if os(iOS)
NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSNotification.Name.UIApplicationWillResignActive, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSNotification.Name.UIApplicationWillResignActive, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationDidFinishLaunching(_:)), name: NSNotification.Name.UIApplicationDidFinishLaunching, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationDidFinishLaunching(_:)), name: NSNotification.Name.UIApplicationDidFinishLaunching, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil)
#elseif os(OSX) #elseif os(OSX)
NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSNotification.Name.NSApplicationWillResignActive, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSApplication.willResignActiveNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(NSApplicationDelegate.applicationDidFinishLaunching(_:)), name: NSNotification.Name.NSApplicationDidFinishLaunching, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationDidFinishLaunching(_:)), name: NSApplication.didFinishLaunchingNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationWillEnterForeground(_:)), name: NSNotification.Name.NSApplicationWillBecomeActive, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationWillEnterForeground(_:)), name: NSApplication.willBecomeActiveNotification, object: nil)
#else #else
#endif #endif

View File

@@ -188,7 +188,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0700; LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800; LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Armchair; ORGANIZATIONNAME = Armchair;
TargetAttributes = { TargetAttributes = {
F8111E0419A951050040E7D1 = { F8111E0419A951050040E7D1 = {
@@ -327,14 +327,20 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -362,6 +368,7 @@
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
@@ -374,14 +381,20 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -401,6 +414,7 @@
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };
@@ -422,7 +436,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "iOS Example"; PRODUCT_NAME = "iOS Example";
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@@ -440,7 +454,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "iOS Example"; PRODUCT_NAME = "iOS Example";
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };