Updates for Swift 2

This commit is contained in:
Matt Coneybeare
2015-09-24 07:48:12 -04:00
parent ad5a344d1c
commit ce4432f0e2
13 changed files with 76 additions and 58 deletions

View File

@@ -355,7 +355,8 @@
F8111E2A19A95C8B0040E7D1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Armchair;
TargetAttributes = {
E6A0AF6419C9CFF400C3A7DC = {
@@ -554,6 +555,7 @@
INSTALL_PATH = "";
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Armchair;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
@@ -570,6 +572,7 @@
INSTALL_PATH = "";
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Armchair;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
@@ -592,6 +595,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
PRODUCT_NAME = Armchair;
SDKROOT = macosx;
@@ -616,6 +620,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
PRODUCT_NAME = Armchair;
SDKROOT = macosx;
@@ -638,6 +643,7 @@
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
@@ -652,6 +658,7 @@
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
@@ -668,6 +675,7 @@
INSTALL_PATH = "";
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Armchair;
SDKROOT = macosx;
SKIP_INSTALL = YES;
@@ -685,6 +693,7 @@
INSTALL_PATH = "";
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Armchair;
SDKROOT = macosx;
SKIP_INSTALL = YES;
@@ -714,6 +723,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -793,6 +803,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
@@ -812,6 +823,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
<capability name="box content view" minToolsVersion="7.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -675,7 +676,7 @@
<window title="Mac Example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES"/>
<rect key="contentRect" x="335" y="390" width="400" height="368"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="400" height="368"/>
<autoresizingMask key="autoresizingMask"/>
@@ -692,7 +693,7 @@
</imageView>
<box autoresizesSubviews="NO" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="0Gb-KD-yfU">
<rect key="frame" x="17" y="250" width="366" height="100"/>
<view key="contentView">
<view key="contentView" id="bbk-jP-boF">
<rect key="frame" x="1" y="1" width="364" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@@ -750,13 +751,13 @@
</subviews>
</view>
<constraints>
<constraint firstAttribute="centerX" secondItem="YED-uj-VLq" secondAttribute="centerX" id="0D2-Qc-szZ"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="top" secondItem="0Gb-KD-yfU" secondAttribute="top" constant="-13" id="0dP-ks-bhc"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="top" secondItem="YED-uj-VLq" secondAttribute="bottom" constant="-11" id="FTY-wK-gxK"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="leading" secondItem="jkm-ga-2sM" secondAttribute="leading" constant="-45" id="V7U-7Z-CIK"/>
<constraint firstItem="jkm-ga-2sM" firstAttribute="bottom" secondItem="yGG-Wr-1xP" secondAttribute="bottom" id="WZR-Hf-JcJ"/>
<constraint firstAttribute="centerX" secondItem="YED-uj-VLq" secondAttribute="centerX" id="D1u-uE-BYQ"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="top" secondItem="YED-uj-VLq" secondAttribute="bottom" constant="-11" id="HED-pQ-Syb"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="leading" secondItem="jkm-ga-2sM" secondAttribute="leading" constant="-45" id="Krx-CK-vgG"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="top" secondItem="0Gb-KD-yfU" secondAttribute="top" constant="-13" id="Yxh-EJ-Gft"/>
<constraint firstAttribute="height" constant="94" id="aN9-Sz-28k"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="trailing" secondItem="YED-uj-VLq" secondAttribute="trailing" constant="-30" id="iUR-We-Kf1"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="trailing" secondItem="YED-uj-VLq" secondAttribute="trailing" constant="-30" id="kVF-vs-OfD"/>
<constraint firstItem="jkm-ga-2sM" firstAttribute="bottom" secondItem="yGG-Wr-1xP" secondAttribute="bottom" id="sDl-pK-HF9"/>
</constraints>
<color key="borderColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="textColor" catalog="System" colorSpace="catalog"/>

View File

@@ -5,11 +5,21 @@
"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",

View File

@@ -3,43 +3,30 @@
{
"orientation" : "portrait",
"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",
"scale" : "2x"
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {

View File

@@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>

View File

@@ -11,7 +11,7 @@
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>

View File

@@ -55,7 +55,7 @@ extension ViewController {
// Only set it if we are using Armchair localizations
if !Armchair.useMainAppBundleForLocalizations() {
var currentLocalization: NSString = NSBundle.mainBundle().preferredLocalizations[0] as! NSString
let currentLocalization: NSString = NSBundle.mainBundle().preferredLocalizations[0] as NSString
// Only set it if we are using a different language than this apps development language
if let developmentLocalization = NSBundle.mainBundle().developmentLocalization {
if currentLocalization != developmentLocalization {
@@ -74,7 +74,7 @@ extension ViewController {
#endif
}
@IBAction func presentStandardPrompt(AnyObject) {
@IBAction func presentStandardPrompt(_: AnyObject) {
resetAppReviewManager()
// The AppID is the only required setup
@@ -92,7 +92,7 @@ extension ViewController {
Armchair.userDidSignificantEvent(true)
}
@IBAction func presentCustomizedPrompt(AnyObject) {
@IBAction func presentCustomizedPrompt(_: AnyObject) {
resetAppReviewManager()
// The AppID is the only required setup
@@ -150,23 +150,23 @@ extension ViewController {
Armchair.affiliateCampaignCode("Armchair-ExampleApp")
// Armchair is block based, so setup some blocks on events
Armchair.onDidDeclineToRate() { println("[Example App] The user just declined to rate") }
Armchair.onDidDisplayAlert() { println("[Example App] We just displayed the rating prompt") }
Armchair.onDidOptToRate() { println("[Example App] The user just opted to rate") }
Armchair.onDidOptToRemindLater({ println("[Example App] The user just opted to remind later") })
Armchair.onDidDeclineToRate() { print("[Example App] The user just declined to rate") }
Armchair.onDidDisplayAlert() { print("[Example App] We just displayed the rating prompt") }
Armchair.onDidOptToRate() { print("[Example App] The user just opted to rate") }
Armchair.onDidOptToRemindLater({ print("[Example App] The user just opted to remind later") })
#if os(iOS)
Armchair.onWillPresentModalView({ println("[Example App] About to present the modal view. Animated: \($0)") })
Armchair.onDidDismissModalView({ println("[Example App] Just dismissed the modal view. Animated: \($0)") })
Armchair.onWillPresentModalView({ print("[Example App] About to present the modal view. Animated: \($0)") })
Armchair.onDidDismissModalView({ print("[Example App] Just dismissed the modal view. Animated: \($0)") })
#endif
// Armchair has sensible defaults for the NSUserDefault keys it uses, but you can customize that here
Armchair.setKey("kSettingsSignificantEventTally", ArmchairKey.SignificantEventCount)
Armchair.setKey("kSettingsSignificantEventTally", armchairKeyType: ArmchairKey.SignificantEventCount)
// You can also call it with a block to circumvent any of Armchair should rate logic.
Armchair.userDidSignificantEvent({
(trackingInfo: ArmchairTrackingInfo) -> (Bool) in
// the trackingInfo.info dictionary has all the keys/value Armchair uses to determine whether or not to show a prompt
println("[Example App] \(trackingInfo)")
print("[Example App] \(trackingInfo)")
return true
})
@@ -186,7 +186,7 @@ extension ViewController {
}
#if os(iOS)
@IBAction func presentStoreKitPrompt(AnyObject) {
@IBAction func presentStoreKitPrompt(_: AnyObject) {
resetAppReviewManager()
// The AppID is the only required setup
@@ -212,7 +212,7 @@ extension ViewController {
Armchair.resetDefaults()
}
@IBAction func openUrbanApps(AnyObject) {
@IBAction func openUrbanApps(_: AnyObject) {
if let url = NSURL(string: "http://urbanapps.com") {
#if os(iOS)
UIApplication.sharedApplication().openURL(url)

View File

@@ -168,7 +168,8 @@
E60FA7B219C908FE00179D70 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Armchair;
TargetAttributes = {
E60FA7B919C908FE00179D70 = {
@@ -311,6 +312,7 @@
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -375,6 +377,7 @@
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = "Example/Info-Mac.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
@@ -386,6 +389,7 @@
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = "Example/Info-Mac.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;

View File

@@ -1534,7 +1534,7 @@ public class Manager : ArmchairManager {
// MARK: Internet Connectivity
private func connectedToNetwork() -> Bool {
var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0))
var zeroAddress = sockaddr_in()
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
zeroAddress.sin_family = sa_family_t(AF_INET)
@@ -1545,7 +1545,7 @@ public class Manager : ArmchairManager {
}
var flags : SCNetworkReachabilityFlags = []
if SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags) {
if !SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags) {
return false
}

View File

@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@@ -4,10 +4,12 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Armchair Tests</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -20,7 +22,5 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleDisplayName</key>
<string>Armchair Tests</string>
</dict>
</plist>

View File

@@ -195,7 +195,8 @@
F8111DFD19A951050040E7D1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Armchair;
TargetAttributes = {
F8111E0419A951050040E7D1 = {
@@ -352,6 +353,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -424,6 +426,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "iOS Example";
PROVISIONING_PROFILE = "";
};
@@ -440,6 +443,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example/Info-iOS.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.armchair.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "iOS Example";
PROVISIONING_PROFILE = "";
};