Skip to content

Commit fdde4ba

Browse files
committed
[PlaygroundSupport] Migrated the XCPlayground framework and its tests to Swift 4.2.
This is for <rdar://problem/45676453>.
1 parent 9663a83 commit fdde4ba

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

PlaygroundSupport/PlaygroundSupport.xcodeproj/project.pbxproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -819,9 +819,15 @@
819819
LastUpgradeCheck = 0910;
820820
ORGANIZATIONNAME = "Apple Inc.";
821821
TargetAttributes = {
822+
1DF4116118DCB596001CDFC7 = {
823+
LastSwiftMigration = 1010;
824+
};
822825
5E36505A1B56D83300205D2D = {
823826
CreatedOnToolsVersion = 7.0;
824827
};
828+
620174C9194645E60012C53A = {
829+
LastSwiftMigration = 1010;
830+
};
825831
94182A0A1D25D5F5002CCB9E = {
826832
CreatedOnToolsVersion = 8.0;
827833
DevelopmentTeam = 59GAB85EFG;
@@ -850,14 +856,20 @@
850856
A83190111CF607C70015809A = {
851857
LastSwiftMigration = 1010;
852858
};
859+
A8E46BDD1ACB6C9D003F5755 = {
860+
LastSwiftMigration = 1010;
861+
};
853862
A8FBD6A21C74FEE6005B5982 = {
854863
CreatedOnToolsVersion = 7.3;
864+
LastSwiftMigration = 1010;
855865
};
856866
A8FBD6B11C752475005B5982 = {
857867
CreatedOnToolsVersion = 7.3;
868+
LastSwiftMigration = 1010;
858869
};
859870
A8FBD6C11C75249E005B5982 = {
860871
CreatedOnToolsVersion = 7.3;
872+
LastSwiftMigration = 1010;
861873
};
862874
};
863875
};
@@ -1308,7 +1320,7 @@
13081320
GCC_WARN_UNUSED_FUNCTION = YES;
13091321
GCC_WARN_UNUSED_VARIABLE = YES;
13101322
SWIFT_STDLIB = swiftCore;
1311-
SWIFT_VERSION = 3.0;
1323+
SWIFT_VERSION = 4.2;
13121324
};
13131325
name = Debug;
13141326
};
@@ -1342,7 +1354,7 @@
13421354
GCC_WARN_UNUSED_VARIABLE = YES;
13431355
SWIFT_SKIP_IMPLICIT_STDLIB_RUNPATH_SEARCH_PATH = YES;
13441356
SWIFT_STDLIB = swiftCore;
1345-
SWIFT_VERSION = 3.0;
1357+
SWIFT_VERSION = 4.2;
13461358
};
13471359
name = Release;
13481360
};
@@ -1535,7 +1547,6 @@
15351547
SDKROOT = macosx;
15361548
STRIP_SWIFT_SYMBOLS = NO;
15371549
SWIFT_INSTALL_OBJC_HEADER = NO;
1538-
SWIFT_VERSION = 4.2;
15391550
};
15401551
name = Debug;
15411552
};
@@ -1557,7 +1568,6 @@
15571568
SDKROOT = macosx;
15581569
STRIP_SWIFT_SYMBOLS = NO;
15591570
SWIFT_INSTALL_OBJC_HEADER = NO;
1560-
SWIFT_VERSION = 4.2;
15611571
};
15621572
name = Release;
15631573
};
@@ -1604,7 +1614,6 @@
16041614
STRIP_SWIFT_SYMBOLS = NO;
16051615
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
16061616
SWIFT_INSTALL_OBJC_HEADER = NO;
1607-
SWIFT_VERSION = 4.2;
16081617
VALID_ARCHS = x86_64;
16091618
WRAPPER_EXTENSION = framework;
16101619
};
@@ -1647,7 +1656,6 @@
16471656
STRIP_SWIFT_SYMBOLS = NO;
16481657
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
16491658
SWIFT_INSTALL_OBJC_HEADER = NO;
1650-
SWIFT_VERSION = 4.2;
16511659
VALIDATE_PRODUCT = YES;
16521660
VALID_ARCHS = x86_64;
16531661
WRAPPER_EXTENSION = framework;
@@ -1697,7 +1705,6 @@
16971705
STRIP_SWIFT_SYMBOLS = NO;
16981706
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
16991707
SWIFT_INSTALL_OBJC_HEADER = NO;
1700-
SWIFT_VERSION = 4.2;
17011708
VALID_ARCHS = x86_64;
17021709
WRAPPER_EXTENSION = framework;
17031710
};
@@ -1740,7 +1747,6 @@
17401747
STRIP_SWIFT_SYMBOLS = NO;
17411748
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
17421749
SWIFT_INSTALL_OBJC_HEADER = NO;
1743-
SWIFT_VERSION = 4.2;
17441750
VALIDATE_PRODUCT = YES;
17451751
VALID_ARCHS = x86_64;
17461752
WRAPPER_EXTENSION = framework;
@@ -1801,7 +1807,6 @@
18011807
PRODUCT_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode.PlaygroundSupportTests-OSX";
18021808
PRODUCT_NAME = "$(TARGET_NAME)";
18031809
SDKROOT = macosx;
1804-
SWIFT_VERSION = 4.2;
18051810
};
18061811
name = Debug;
18071812
};
@@ -1840,7 +1845,6 @@
18401845
PRODUCT_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode.PlaygroundSupportTests-OSX";
18411846
PRODUCT_NAME = "$(TARGET_NAME)";
18421847
SDKROOT = macosx;
1843-
SWIFT_VERSION = 4.2;
18441848
};
18451849
name = Release;
18461850
};
@@ -1882,7 +1886,6 @@
18821886
PRODUCT_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode.PlaygroundSupportTests-iOS";
18831887
PRODUCT_NAME = "$(TARGET_NAME)";
18841888
SDKROOT = iphoneos;
1885-
SWIFT_VERSION = 4.2;
18861889
};
18871890
name = Debug;
18881891
};
@@ -1919,7 +1922,6 @@
19191922
PRODUCT_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode.PlaygroundSupportTests-iOS";
19201923
PRODUCT_NAME = "$(TARGET_NAME)";
19211924
SDKROOT = iphoneos;
1922-
SWIFT_VERSION = 4.2;
19231925
VALIDATE_PRODUCT = YES;
19241926
};
19251927
name = Release;
@@ -1961,7 +1963,6 @@
19611963
PRODUCT_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode.PlaygroundSupportTests-tvOS";
19621964
PRODUCT_NAME = "$(TARGET_NAME)";
19631965
SDKROOT = appletvos;
1964-
SWIFT_VERSION = 4.2;
19651966
};
19661967
name = Debug;
19671968
};
@@ -1997,7 +1998,6 @@
19971998
PRODUCT_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode.PlaygroundSupportTests-tvOS";
19981999
PRODUCT_NAME = "$(TARGET_NAME)";
19992000
SDKROOT = appletvos;
2000-
SWIFT_VERSION = 4.2;
20012001
VALIDATE_PRODUCT = YES;
20022002
};
20032003
name = Release;

PlaygroundSupport/XCPlaygroundTests/CaptureValueTests.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313
import XCTest
1414
import XCPlayground
1515

16+
// This is intentionally redefined here in the tests, as this string cannot change as it has clients which refer to it by the string value rather than by symbol.
17+
let captureValueNotification = Notification.Name(rawValue: "XCPCaptureValue")
18+
1619
class CaptureValueTests: XCTestCase {
1720

1821
// MARK: Deprected XCPlaygroundPage
1922

2023
func testPlaygroundPageCaptureValue() {
2124
let value = 321
2225
let identifier = "My Identifier 101"
23-
expectation(forNotification: "XCPCaptureValue", object: XCPlaygroundPage.currentPage) { (notification) in
26+
expectation(forNotification: captureValueNotification, object: XCPlaygroundPage.currentPage) { (notification) in
2427
guard let userInfoValue = notification.userInfo?["value"] as? Int else { return false }
2528
XCTAssertEqual(userInfoValue, value)
2629

@@ -38,7 +41,7 @@ class CaptureValueTests: XCTestCase {
3841
func testLegacyCaptureValue() {
3942
let value = 123
4043
let identifier = "My Identifier"
41-
expectation(forNotification: "XCPCaptureValue", object: XCPlaygroundPage.currentPage) { (notification) in
44+
expectation(forNotification: captureValueNotification, object: XCPlaygroundPage.currentPage) { (notification) in
4245
guard let userInfoValue = notification.userInfo?["value"] as? Int else { return false }
4346
XCTAssertEqual(userInfoValue, value)
4447

PlaygroundSupport/XCPlaygroundTests/LiveViewTests.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ fileprivate typealias ViewType = UIView
2525
fileprivate typealias ViewControllerType = UIViewController
2626
#endif
2727

28+
// This is intentionally redefined here in the tests, as this string cannot change as it has clients which refer to it by the string value rather than by symbol.
29+
let playgroundPageLiveViewDidChangeNotification = Notification.Name(rawValue: "XCPlaygroundPageLiveViewDidChangeNotification")
30+
2831
class LiveViewTests: XCTestCase {
2932

3033
override func setUp() {
@@ -41,7 +44,7 @@ class LiveViewTests: XCTestCase {
4144
let view = ViewType()
4245

4346
// Test setting to a view
44-
expectation(forNotification: "XCPlaygroundPageLiveViewDidChangeNotification", object: XCPlaygroundPage.currentPage) { (notification) in
47+
expectation(forNotification: playgroundPageLiveViewDidChangeNotification, object: XCPlaygroundPage.currentPage) { (notification) in
4548
guard let userInfoView = notification.userInfo?["XCPlaygroundPageLiveView"] as? ViewType else { return false }
4649
guard notification.userInfo?["XCPlaygroundPageLiveViewController"] == nil else { return false }
4750
XCTAssertEqual(userInfoView, view)
@@ -51,7 +54,7 @@ class LiveViewTests: XCTestCase {
5154
waitForExpectations(timeout: 0.1, handler: nil)
5255

5356
// Test setting back to nil
54-
expectation(forNotification: "XCPlaygroundPageLiveViewDidChangeNotification", object: XCPlaygroundPage.currentPage) { (notification) in
57+
expectation(forNotification: playgroundPageLiveViewDidChangeNotification, object: XCPlaygroundPage.currentPage) { (notification) in
5558
guard notification.userInfo?["XCPlaygroundPageLiveView"] == nil else { return false }
5659
guard notification.userInfo?["XCPlaygroundPageLiveViewController"] == nil else { return false }
5760
return true
@@ -64,7 +67,7 @@ class LiveViewTests: XCTestCase {
6467
let viewController = ViewControllerType()
6568

6669
// Test setting to a view controller
67-
expectation(forNotification: "XCPlaygroundPageLiveViewDidChangeNotification", object: XCPlaygroundPage.currentPage) { (notification) in
70+
expectation(forNotification: playgroundPageLiveViewDidChangeNotification, object: XCPlaygroundPage.currentPage) { (notification) in
6871
guard let userInfoViewController = notification.userInfo?["XCPlaygroundPageLiveViewController"] as? ViewControllerType else { return false }
6972
guard notification.userInfo?["XCPlaygroundPageLiveView"] == nil else { return false }
7073
XCTAssertEqual(userInfoViewController, viewController)
@@ -74,7 +77,7 @@ class LiveViewTests: XCTestCase {
7477
waitForExpectations(timeout: 0.1, handler: nil)
7578

7679
// Test setting back to nil
77-
expectation(forNotification: "XCPlaygroundPageLiveViewDidChangeNotification", object: XCPlaygroundPage.currentPage) { (notification) in
80+
expectation(forNotification: playgroundPageLiveViewDidChangeNotification, object: XCPlaygroundPage.currentPage) { (notification) in
7881
guard notification.userInfo?["XCPlaygroundPageLiveView"] == nil else { return false }
7982
guard notification.userInfo?["XCPlaygroundPageLiveViewController"] == nil else { return false }
8083
return true
@@ -87,7 +90,7 @@ class LiveViewTests: XCTestCase {
8790

8891
func testXCPShowView() {
8992
let view = ViewType()
90-
expectation(forNotification: "XCPlaygroundPageLiveViewDidChangeNotification", object: XCPlaygroundPage.currentPage) { (notification) in
93+
expectation(forNotification: playgroundPageLiveViewDidChangeNotification, object: XCPlaygroundPage.currentPage) { (notification) in
9194
guard let userInfoView = notification.userInfo?["XCPlaygroundPageLiveView"] as? ViewType else { return false }
9295
XCTAssertEqual(userInfoView, view)
9396
return true

0 commit comments

Comments
 (0)