Skip to content

Commit dd531aa

Browse files
committed
Merge pull request #888 from ParsePlatform/nlutsenko.starters
Update Travis-CI to Xcode 7.3 and fix all starter projects for latest Swift.
2 parents a336b2f + c58910a commit dd531aa

File tree

14 files changed

+111
-142
lines changed

14 files changed

+111
-142
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ branches:
33
- master
44
language: objective-c
55
os: osx
6-
osx_image: xcode7.2
6+
osx_image: xcode7.3
77
env:
88
global:
99
- LC_CTYPE=en_US.UTF-8

ParseStarterProject/OSX/ParseOSXStarterProject-Swift/ParseOSXStarterProject/AppDelegate.swift

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Parse
1414
@NSApplicationMain
1515
class AppDelegate: NSObject, NSApplicationDelegate {
1616

17-
@IBOutlet weak var window: NSWindow!
17+
@IBOutlet weak var window: NSWindow?
1818

1919
func applicationDidFinishLaunching(aNotification: NSNotification) {
2020
// Enable storing and querying data from Local Datastore.
@@ -23,7 +23,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2323

2424
// ****************************************************************************
2525
// Uncomment and fill in with your Parse credentials:
26-
// [Parse setApplicationId:@"your_application_id" clientKey:@"your_client_key"];
26+
// Parse.setApplicationId("your_application_id", clientKey: "your_client_key")
2727
// ****************************************************************************
2828

2929
PFUser.enableAutomaticUser()
@@ -37,9 +37,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3737
// ****************************************************************************
3838
// Uncomment these lines to register for Push Notifications.
3939
//
40-
// let types = NSRemoteNotificationType.Alert |
41-
// NSRemoteNotificationType.Badge |
42-
// NSRemoteNotificationType.Sound;
40+
// let types: NSRemoteNotificationType = [.Alert, .Badge, .Sound]
4341
// NSApplication.sharedApplication().registerForRemoteNotificationTypes(types)
4442
//
4543
// ****************************************************************************
@@ -54,7 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5452

5553
PFPush.subscribeToChannelInBackground("") { (succeeded: Bool, error: NSError?) in
5654
if succeeded {
57-
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
55+
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n")
5856
} else {
5957
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
6058
}
@@ -68,13 +66,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6866
// ****************************************************************************
6967
// Uncomment these lines to track Push Notifications open rate in Analytics.
7068
//
71-
// Swift 1.2
72-
// func application(application: NSApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
73-
// PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
74-
// }
75-
//
76-
// Swift 2.0
77-
// func application(application: NSApplication, didReceiveRemoteNotification userInfo: [String : AnyObject]) {
78-
// PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
79-
// }
69+
// func application(application: NSApplication, didReceiveRemoteNotification userInfo: [String : AnyObject]) {
70+
// PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
71+
// }
8072
}

ParseStarterProject/iOS/ParseStarterProject-Swift/ParseStarterProject-Swift.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/* End PBXAggregateTarget section */
2222

2323
/* Begin PBXBuildFile section */
24+
8136E54C1CB4D7DD0011D421 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8136E54B1CB4D7DD0011D421 /* Launch.storyboard */; };
2425
814C3ACA1B69877600E307BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 814C3AC61B69877600E307BB /* Main.storyboard */; };
2526
814C3ACB1B69877600E307BB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 814C3AC81B69877600E307BB /* Images.xcassets */; };
2627
81BA814B1A49DA1800E65899 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81BA814A1A49DA1800E65899 /* AppDelegate.swift */; };
@@ -44,6 +45,7 @@
4445
/* End PBXContainerItemProxy section */
4546

4647
/* Begin PBXFileReference section */
48+
8136E54B1CB4D7DD0011D421 /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = "<group>"; };
4749
814C3AC71B69877600E307BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
4850
814C3AC81B69877600E307BB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
4951
814C3AC91B69877600E307BB /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -82,6 +84,7 @@
8284
children = (
8385
814C3AC81B69877600E307BB /* Images.xcassets */,
8486
814C3AC91B69877600E307BB /* Info.plist */,
87+
8136E54B1CB4D7DD0011D421 /* Launch.storyboard */,
8588
);
8689
path = Resources;
8790
sourceTree = "<group>";
@@ -202,6 +205,7 @@
202205
files = (
203206
814C3ACA1B69877600E307BB /* Main.storyboard in Resources */,
204207
814C3ACB1B69877600E307BB /* Images.xcassets in Resources */,
208+
8136E54C1CB4D7DD0011D421 /* Launch.storyboard in Resources */,
205209
);
206210
runOnlyForDeploymentPostprocessing = 0;
207211
};
@@ -354,12 +358,12 @@
354358
isa = XCBuildConfiguration;
355359
buildSettings = {
356360
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
357-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
358361
FRAMEWORK_SEARCH_PATHS = (
359362
"$(inherited)",
360363
"$(PROJECT_DIR)",
361364
);
362365
INFOPLIST_FILE = Resources/Info.plist;
366+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
363367
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
364368
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.$(PRODUCT_NAME:rfc1034identifier)";
365369
PRODUCT_NAME = "ParseStarterProject-Swift";
@@ -370,12 +374,12 @@
370374
isa = XCBuildConfiguration;
371375
buildSettings = {
372376
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
373-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
374377
FRAMEWORK_SEARCH_PATHS = (
375378
"$(inherited)",
376379
"$(PROJECT_DIR)",
377380
);
378381
INFOPLIST_FILE = Resources/Info.plist;
382+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
379383
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
380384
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.$(PRODUCT_NAME:rfc1034identifier)";
381385
PRODUCT_NAME = "ParseStarterProject-Swift";

ParseStarterProject/iOS/ParseStarterProject-Swift/ParseStarterProject/AppDelegate.swift

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4040

4141
PFUser.enableAutomaticUser()
4242

43-
let defaultACL = PFACL();
43+
let defaultACL = PFACL()
4444

4545
// If you would like all objects to be private by default, remove this line.
4646
defaultACL.publicReadAccess = true
@@ -52,42 +52,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5252
// "content_available" was used to trigger a background push (introduced in iOS 7).
5353
// In that case, we skip tracking here to avoid double counting the app-open.
5454

55-
let preBackgroundPush = !application.respondsToSelector("backgroundRefreshStatus")
56-
let oldPushHandlerOnly = !self.respondsToSelector("application:didReceiveRemoteNotification:fetchCompletionHandler:")
57-
var noPushPayload = false;
55+
let oldPushHandlerOnly = !respondsToSelector(#selector(UIApplicationDelegate.application(_:didReceiveRemoteNotification:fetchCompletionHandler:)))
56+
var noPushPayload = false
5857
if let options = launchOptions {
59-
noPushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] == nil;
58+
noPushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] == nil
6059
}
61-
if (preBackgroundPush || oldPushHandlerOnly || noPushPayload) {
60+
if oldPushHandlerOnly || noPushPayload {
6261
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
6362
}
6463
}
6564

66-
//
67-
// Swift 1.2
68-
//
69-
// if application.respondsToSelector("registerUserNotificationSettings:") {
70-
// let userNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
71-
// let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
72-
// application.registerUserNotificationSettings(settings)
73-
// application.registerForRemoteNotifications()
74-
// } else {
75-
// let types = UIRemoteNotificationType.Badge | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Sound
76-
// application.registerForRemoteNotificationTypes(types)
77-
// }
78-
79-
//
80-
// Swift 2.0
81-
//
82-
// if #available(iOS 8.0, *) {
83-
// let types: UIUserNotificationType = [.Alert, .Badge, .Sound]
84-
// let settings = UIUserNotificationSettings(forTypes: types, categories: nil)
85-
// application.registerUserNotificationSettings(settings)
86-
// application.registerForRemoteNotifications()
87-
// } else {
88-
// let types: UIRemoteNotificationType = [.Alert, .Badge, .Sound]
89-
// application.registerForRemoteNotificationTypes(types)
90-
// }
65+
let types: UIUserNotificationType = [.Alert, .Badge, .Sound]
66+
let settings = UIUserNotificationSettings(forTypes: types, categories: nil)
67+
application.registerUserNotificationSettings(settings)
68+
application.registerForRemoteNotifications()
9169

9270
return true
9371
}
@@ -103,7 +81,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
10381

10482
PFPush.subscribeToChannelInBackground("") { (succeeded: Bool, error: NSError?) in
10583
if succeeded {
106-
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
84+
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n")
10785
} else {
10886
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
10987
}

ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
"idiom" : "ipad",
6060
"size" : "76x76",
6161
"scale" : "2x"
62+
},
63+
{
64+
"idiom" : "ipad",
65+
"size" : "83.5x83.5",
66+
"scale" : "2x"
6267
}
6368
],
6469
"info" : {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}

ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json

Lines changed: 0 additions & 49 deletions
This file was deleted.

ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<string>1.13.0</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
25+
<key>UILaunchStoryboardName</key>
26+
<string>Launch</string>
2527
<key>UIMainStoryboardFile</key>
2628
<string>Main</string>
2729
<key>UIRequiredDeviceCapabilities</key>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
6+
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<layoutGuides>
14+
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
15+
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
16+
</layoutGuides>
17+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
18+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
19+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
20+
<subviews>
21+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2016 Parse. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
22+
<rect key="frame" x="20" y="559" width="560" height="21"/>
23+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
24+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
25+
<nil key="highlightedColor"/>
26+
</label>
27+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ParseStarterProject-Swift" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
28+
<rect key="frame" x="20" y="180" width="560" height="43"/>
29+
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
30+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
31+
<nil key="highlightedColor"/>
32+
</label>
33+
</subviews>
34+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
35+
<constraints>
36+
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
37+
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
38+
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
39+
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
40+
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
41+
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
42+
</constraints>
43+
</view>
44+
</viewController>
45+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
46+
</objects>
47+
<point key="canvasLocation" x="53" y="375"/>
48+
</scene>
49+
</scenes>
50+
</document>

ParseStarterProject/iOS/ParseStarterProject/ParseStarterProject/ParseStarterProjectAppDelegate.m

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
5555
// Track an app open here if we launch with a push, unless
5656
// "content_available" was used to trigger a background push (introduced in iOS 7).
5757
// In that case, we skip tracking here to avoid double counting the app-open.
58-
BOOL preBackgroundPush = ![application respondsToSelector:@selector(backgroundRefreshStatus)];
5958
BOOL oldPushHandlerOnly = ![self respondsToSelector:@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)];
6059
BOOL noPushPayload = !launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
61-
if (preBackgroundPush || oldPushHandlerOnly || noPushPayload) {
60+
if (oldPushHandlerOnly || noPushPayload) {
6261
[PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
6362
}
6463
}
6564

66-
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
6765
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
6866
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
6967
UIUserNotificationTypeBadge |
@@ -72,9 +70,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
7270
categories:nil];
7371
[application registerUserNotificationSettings:settings];
7472
[application registerForRemoteNotifications];
75-
} else
76-
#endif
77-
{
73+
} else {
7874
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
7975
UIRemoteNotificationTypeAlert |
8076
UIRemoteNotificationTypeSound)];

ParseStarterProject/tvOS/ParseStarterProject-Swift/ParseStarter/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3030

3131
PFUser.enableAutomaticUser()
3232

33-
let defaultACL = PFACL();
33+
let defaultACL = PFACL()
3434
defaultACL.publicReadAccess = true // If you would like all objects to be private by default, remove this line.
3535
PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser: true)
3636

ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter-Swift.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@
640640
"$(PROJECT_DIR)/Frameworks/iOS",
641641
);
642642
INFOPLIST_FILE = Resources/Info.plist;
643+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
643644
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
644645
PRODUCT_BUNDLE_IDENTIFIER = com.parse.starter;
645646
PRODUCT_NAME = "ParseStarter-Swift";
@@ -657,6 +658,7 @@
657658
"$(PROJECT_DIR)/Frameworks/iOS",
658659
);
659660
INFOPLIST_FILE = Resources/Info.plist;
661+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
660662
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
661663
PRODUCT_BUNDLE_IDENTIFIER = com.parse.starter;
662664
PRODUCT_NAME = "ParseStarter-Swift";

0 commit comments

Comments
 (0)