Skip to content

Commit bf7cc96

Browse files
authored
Swift 3 (#1145)
* Add Xcode 8.0 Swift 3.0 support * Add support for Xcode 8.2.1 (8C1002), iOS 8,9,10 * Correct Bolt to current master. * Revert back to Bolts-ObjC at “1.8.4” to respect carthage. PS : You can update Bolts-ObjC at master to avoid Xcode warning ⚠️ * bumps travis executor * Test modernization * Set SWIFT_VERSION = 3.0 for macOS tests * Bumps starter projects
1 parent 37f9911 commit bf7cc96

File tree

33 files changed

+214
-90
lines changed

33 files changed

+214
-90
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
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.3
6+
osx_image: xcode8.3
77
env:
88
global:
99
- LC_CTYPE=en_US.UTF-8
@@ -35,4 +35,4 @@ after_success:
3535
- |
3636
if [ "$TEST_TYPE" = iOS ] || [ "$TEST_TYPE" = macOS ]; then
3737
bash <(curl -s https://codecov.io/bash)
38-
fi
38+
fi

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
github "BoltsFramework/Bolts-ObjC" "1.8.4"
2-
github "erikdoe/OCMock" "v3.3.1"
2+
github "erikdoe/OCMock" "v3.4"

Configurations/ParseUnitTests-iOS.xcconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ PRODUCT_NAME = ParseUnitTests-iOS
1414
PRODUCT_MODULE_NAME = ParseUnitTests
1515
PRODUCT_BUNDLE_IDENTIFIER = com.parse.unit.ios
1616

17+
SWIFT_VERSION = 3.0
18+
1719
IPHONEOS_DEPLOYMENT_TARGET = 8.0
1820

1921
INFOPLIST_FILE = $(SRCROOT)/Tests/Resources/ParseUnitTests-iOS-Info.plist

Configurations/ParseUnitTests-macOS.xcconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ PRODUCT_NAME = ParseUnitTests-macOS
1414
PRODUCT_MODULE_NAME = ParseUnitTests
1515
PRODUCT_BUNDLE_IDENTIFIER = com.parse.unit.macOS
1616

17+
SWIFT_VERSION = 3.0
18+
1719
INFOPLIST_FILE = $(SRCROOT)/Tests/Resources/ParseUnitTests-OSX-Info.plist
1820

1921
USER_HEADER_SEARCH_PATHS = $(inherited) $(PARSE_DIR)/Parse/Internal/**

Parse.xcodeproj/project.pbxproj

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3852,6 +3852,7 @@
38523852
099C082113AC013900D71869 /* Tests */,
38533853
09D3364C139C54940098E916 /* Frameworks */,
38543854
09D3364B139C54940098E916 /* Products */,
3855+
4AAB99061EE6D7E50073D7A7 /* Recovered References */,
38553856
);
38563857
indentWidth = 4;
38573858
sourceTree = "<group>";
@@ -3909,6 +3910,16 @@
39093910
name = Views;
39103911
sourceTree = "<group>";
39113912
};
3913+
4AAB99061EE6D7E50073D7A7 /* Recovered References */ = {
3914+
isa = PBXGroup;
3915+
children = (
3916+
F5B0B3121B44A05100F3EBC4 /* PFPaymentTransactionObserver_Private.h */,
3917+
97DE045B163214C0007154E8 /* SystemConfiguration.framework */,
3918+
97DE045016321428007154E8 /* CoreLocation.framework */,
3919+
);
3920+
name = "Recovered References";
3921+
sourceTree = "<group>";
3922+
};
39123923
7C83A03B15B4A609005E2C8E /* Commands */ = {
39133924
isa = PBXGroup;
39143925
children = (
@@ -6931,11 +6942,18 @@
69316942
isa = PBXProject;
69326943
attributes = {
69336944
LastSwiftUpdateCheck = 0700;
6934-
LastUpgradeCheck = 0730;
6945+
LastUpgradeCheck = 0820;
69356946
ORGANIZATIONNAME = "Parse Inc.";
69366947
TargetAttributes = {
6948+
810155051BB3832700D7C7BD = {
6949+
LastSwiftMigration = 0830;
6950+
};
6951+
816F441B1A8E8933009CDB32 = {
6952+
LastSwiftMigration = 0900;
6953+
};
69376954
81C3821B19CCA89E0066284A = {
69386955
CreatedOnToolsVersion = 6.0.1;
6956+
LastSwiftMigration = 0830;
69396957
};
69406958
};
69416959
};
@@ -8661,27 +8679,33 @@
86618679
isa = XCBuildConfiguration;
86628680
baseConfigurationReference = 81DCD1491D2DA080002501A2 /* Debug.xcconfig */;
86638681
buildSettings = {
8682+
CLANG_WARN_INFINITE_RECURSION = YES;
8683+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
86648684
};
86658685
name = Debug;
86668686
};
86678687
09D3366C139C54940098E916 /* Release */ = {
86688688
isa = XCBuildConfiguration;
86698689
baseConfigurationReference = 81DCD14A1D2DA080002501A2 /* Release.xcconfig */;
86708690
buildSettings = {
8691+
CLANG_WARN_INFINITE_RECURSION = YES;
8692+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
86718693
};
86728694
name = Release;
86738695
};
86748696
810156671BB3832700D7C7BD /* Debug */ = {
86758697
isa = XCBuildConfiguration;
86768698
baseConfigurationReference = 810154FE1BB382F800D7C7BD /* Parse-watchOS.xcconfig */;
86778699
buildSettings = {
8700+
SWIFT_VERSION = 3.0;
86788701
};
86798702
name = Debug;
86808703
};
86818704
810156681BB3832700D7C7BD /* Release */ = {
86828705
isa = XCBuildConfiguration;
86838706
baseConfigurationReference = 810154FE1BB382F800D7C7BD /* Parse-watchOS.xcconfig */;
86848707
buildSettings = {
8708+
SWIFT_VERSION = 3.0;
86858709
};
86868710
name = Release;
86878711
};
@@ -8731,13 +8755,24 @@
87318755
isa = XCBuildConfiguration;
87328756
baseConfigurationReference = F55ABB531B4F39DA00A0ECD5 /* Parse-iOS.xcconfig */;
87338757
buildSettings = {
8758+
CLANG_ENABLE_MODULES = YES;
8759+
DEFINES_MODULE = YES;
8760+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
8761+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
8762+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
8763+
SWIFT_VERSION = 3.0;
87348764
};
87358765
name = Debug;
87368766
};
87378767
81C3823519CCA89F0066284A /* Release */ = {
87388768
isa = XCBuildConfiguration;
87398769
baseConfigurationReference = F55ABB531B4F39DA00A0ECD5 /* Parse-iOS.xcconfig */;
87408770
buildSettings = {
8771+
CLANG_ENABLE_MODULES = YES;
8772+
DEFINES_MODULE = YES;
8773+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
8774+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
8775+
SWIFT_VERSION = 3.0;
87418776
};
87428777
name = Release;
87438778
};

Parse.xcodeproj/xcshareddata/xcschemes/Parse-iOS-Dynamic.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Parse.xcodeproj/xcshareddata/xcschemes/Parse-iOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Parse.xcodeproj/xcshareddata/xcschemes/Parse-macOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Parse.xcodeproj/xcshareddata/xcschemes/Parse-tvOS-Dynamic.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Parse.xcodeproj/xcshareddata/xcschemes/Parse-tvOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Parse.xcodeproj/xcshareddata/xcschemes/Parse-watchOS-Dynamic.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Parse.xcodeproj/xcshareddata/xcschemes/Parse-watchOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ParseStarterProject/OSX/ParseOSXStarterProject-Swift/ParseOSXStarterProject-Swift.xcodeproj/project.pbxproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,15 @@
151151
isa = PBXProject;
152152
attributes = {
153153
LastSwiftUpdateCheck = 0700;
154-
LastUpgradeCheck = 0730;
154+
LastUpgradeCheck = 0830;
155155
ORGANIZATIONNAME = Parse;
156156
TargetAttributes = {
157157
81993FD51B69AC760077D6B9 = {
158158
CreatedOnToolsVersion = 6.4;
159159
};
160160
81CC85B71A49F2E00076DE19 = {
161161
CreatedOnToolsVersion = 6.1.1;
162+
LastSwiftMigration = 0830;
162163
};
163164
};
164165
};
@@ -268,15 +269,18 @@
268269
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
269270
CLANG_WARN_EMPTY_BODY = YES;
270271
CLANG_WARN_ENUM_CONVERSION = YES;
272+
CLANG_WARN_INFINITE_RECURSION = YES;
271273
CLANG_WARN_INT_CONVERSION = YES;
272274
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
275+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
273276
CLANG_WARN_UNREACHABLE_CODE = YES;
274277
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
275278
COPY_PHASE_STRIP = NO;
276279
ENABLE_STRICT_OBJC_MSGSEND = YES;
277280
ENABLE_TESTABILITY = YES;
278281
GCC_C_LANGUAGE_STANDARD = gnu99;
279282
GCC_DYNAMIC_NO_PIC = NO;
283+
GCC_NO_COMMON_BLOCKS = YES;
280284
GCC_OPTIMIZATION_LEVEL = 0;
281285
GCC_PREPROCESSOR_DEFINITIONS = (
282286
"DEBUG=1",
@@ -310,15 +314,18 @@
310314
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
311315
CLANG_WARN_EMPTY_BODY = YES;
312316
CLANG_WARN_ENUM_CONVERSION = YES;
317+
CLANG_WARN_INFINITE_RECURSION = YES;
313318
CLANG_WARN_INT_CONVERSION = YES;
314319
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
320+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
315321
CLANG_WARN_UNREACHABLE_CODE = YES;
316322
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
317323
COPY_PHASE_STRIP = YES;
318324
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
319325
ENABLE_NS_ASSERTIONS = NO;
320326
ENABLE_STRICT_OBJC_MSGSEND = YES;
321327
GCC_C_LANGUAGE_STANDARD = gnu99;
328+
GCC_NO_COMMON_BLOCKS = YES;
322329
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
323330
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
324331
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -328,6 +335,7 @@
328335
MACOSX_DEPLOYMENT_TARGET = 10.9;
329336
MTL_ENABLE_DEBUG_INFO = NO;
330337
SDKROOT = macosx;
338+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
331339
};
332340
name = Release;
333341
};
@@ -344,6 +352,7 @@
344352
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
345353
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.$(PRODUCT_NAME:rfc1034identifier)";
346354
PRODUCT_NAME = "ParseOSXStarterProject-Swift";
355+
SWIFT_VERSION = 3.0;
347356
};
348357
name = Debug;
349358
};
@@ -360,6 +369,7 @@
360369
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
361370
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.$(PRODUCT_NAME:rfc1034identifier)";
362371
PRODUCT_NAME = "ParseOSXStarterProject-Swift";
372+
SWIFT_VERSION = 3.0;
363373
};
364374
name = Release;
365375
};

ParseStarterProject/OSX/ParseOSXStarterProject-Swift/ParseOSXStarterProject-Swift.xcodeproj/xcshareddata/xcschemes/ParseOSXStarterProject-Swift.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "NO"

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1616

1717
@IBOutlet weak var window: NSWindow?
1818

19-
func applicationDidFinishLaunching(aNotification: NSNotification) {
19+
func applicationDidFinishLaunching(_ aNotification: Notification) {
2020
// ****************************************************************************
2121
// Initialize Parse SDK
2222
// ****************************************************************************
@@ -32,17 +32,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3232

3333
// Enable storing and querying data from Local Datastore.
3434
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
35-
$0.localDatastoreEnabled = true
35+
$0.isLocalDatastoreEnabled = true
3636
}
37-
Parse.initializeWithConfiguration(configuration)
37+
Parse.initialize(with: configuration)
3838

3939
PFUser.enableAutomaticUser()
4040

4141
let defaultACL: PFACL = PFACL()
4242
// If you would like all objects to be private by default, remove this line.
43-
defaultACL.publicReadAccess = true
43+
defaultACL.getPublicReadAccess = true
4444

45-
PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser: true)
45+
PFACL.setDefault(defaultACL, withAccessForCurrentUser: true)
4646

4747
// ****************************************************************************
4848
// Uncomment these lines to register for Push Notifications.
@@ -52,24 +52,23 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5252
//
5353
// ****************************************************************************
5454

55-
PFAnalytics.trackAppOpenedWithLaunchOptions(nil)
55+
PFAnalytics.trackAppOpened(launchOptions: nil)
5656
}
5757

58-
func application(application: NSApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
59-
let installation = PFInstallation.currentInstallation()
60-
installation?.setDeviceTokenFromData(deviceToken)
58+
func application(_ application: NSApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
59+
let installation = PFInstallation.current()
60+
installation?.setDeviceTokenFrom(deviceToken)
6161
installation?.saveInBackground()
62-
63-
PFPush.subscribeToChannelInBackground("") { (succeeded: Bool, error: NSError?) in
62+
PFPush.subscribeToChannel(inBackground: "") { (succeeded: Bool, error: Error?) in
6463
if succeeded {
6564
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n")
6665
} else {
67-
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
66+
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error as Any)
6867
}
6968
}
7069
}
7170

72-
func application(application: NSApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
71+
func application(_ application: NSApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
7372
print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
7473
}
7574

ParseStarterProject/OSX/ParseOSXStarterProject/ParseOSXStarterProject.xcodeproj/xcshareddata/xcschemes/ParseOSXStarterProject.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "NO"

0 commit comments

Comments
 (0)