Skip to content

Commit 1196fcf

Browse files
committed
Workarounds for SE-0072 transition.
Banning the String-to-NSString conversion unfortunately also bans the transitive String-to-NSString-to-NSSTRING_ENUM conversion without an intervening NSString conversion. Work around this until we can get a fix into the compiler.
1 parent 7ce15cf commit 1196fcf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

PlaygroundSupport/PlaygroundSupport/PlaygroundPage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public final class PlaygroundPage {
5050
///
5151
public var needsIndefiniteExecution: Bool = false {
5252
didSet {
53-
NotificationCenter.default.post(name: "PlaygroundPageNeedsIndefiniteExecutionDidChangeNotification" as NSNotification.Name, object: self, userInfo: [ AnyHashable("PlaygroundPageNeedsIndefiniteExecution") : needsIndefiniteExecution as AnyObject])
53+
NotificationCenter.default.post(name: "PlaygroundPageNeedsIndefiniteExecutionDidChangeNotification" as NSString as NSNotification.Name, object: self, userInfo: [ AnyHashable("PlaygroundPageNeedsIndefiniteExecution") : needsIndefiniteExecution as AnyObject])
5454
}
5555
}
5656

@@ -59,7 +59,7 @@ public final class PlaygroundPage {
5959
/// This method does not return, as Xcode will kill the process hosting playground execution when this method is called.
6060
public func finishExecution() -> Never {
6161
// Send a message to Xcode requesting that we be killed.
62-
NotificationCenter.default.post(name: "PlaygroundPageFinishExecutionNotification" as NSNotification.Name, object: self, userInfo: nil)
62+
NotificationCenter.default.post(name: "PlaygroundPageFinishExecutionNotification" as NSString as NSNotification.Name, object: self, userInfo: nil)
6363

6464
// Sleep for a while to let Xcode kill us.
6565
for _ in 1...10 {
@@ -102,7 +102,7 @@ public final class PlaygroundPage {
102102
userInfo = [:]
103103
}
104104

105-
NotificationCenter.default.post(name: "PlaygroundPageLiveViewDidChangeNotification" as NSNotification.Name, object: self, userInfo: userInfo)
105+
NotificationCenter.default.post(name: "PlaygroundPageLiveViewDidChangeNotification" as NSString as NSNotification.Name, object: self, userInfo: userInfo)
106106
}
107107
}
108108
}

PlaygroundSupport/XCPlayground/XCPlaygroundPage.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public final class XCPlaygroundPage {
4545
/// - note: This function has been deprecated.
4646
@available(*,deprecated) public func captureValue<T>(value: T, withIdentifier identifier: String) {
4747
if let value = value as? AnyObject {
48-
NotificationCenter.default.post(name: "XCPCaptureValue" as NSNotification.Name, object: self, userInfo: [ AnyHashable("value") : value, AnyHashable("identifier"): identifier as AnyObject])
48+
NotificationCenter.default.post(name: "XCPCaptureValue" as NSString as NSNotification.Name, object: self, userInfo: [ AnyHashable("value") : value, AnyHashable("identifier"): identifier as AnyObject])
4949
}
5050
}
5151

@@ -62,7 +62,7 @@ public final class XCPlaygroundPage {
6262
@available(*,deprecated,message:"Use 'PlaygroundPage.current.needsIndefiniteExecution' from the 'PlaygroundSupport' module instead")
6363
public var needsIndefiniteExecution: Bool = false {
6464
didSet {
65-
NotificationCenter.default.post(name: "XCPlaygroundPageNeedsIndefiniteExecutionDidChangeNotification" as NSNotification.Name, object: self, userInfo: [ AnyHashable("XCPlaygroundPageNeedsIndefiniteExecution") : needsIndefiniteExecution as AnyObject])
65+
NotificationCenter.default.post(name: "XCPlaygroundPageNeedsIndefiniteExecutionDidChangeNotification" as NSString as NSNotification.Name, object: self, userInfo: [ AnyHashable("XCPlaygroundPageNeedsIndefiniteExecution") : needsIndefiniteExecution as AnyObject])
6666
}
6767
}
6868

@@ -72,7 +72,7 @@ public final class XCPlaygroundPage {
7272
@available(*,deprecated,message:"Use 'PlaygroundPage.current.finishExecution()' from the 'PlaygroundSupport' module instead")
7373
public func finishExecution() -> Never {
7474
// Send a message to Xcode requesting that we be killed.
75-
NotificationCenter.default.post(name: "XCPlaygroundPageFinishExecutionNotification" as NSNotification.Name, object: self, userInfo: nil)
75+
NotificationCenter.default.post(name: "XCPlaygroundPageFinishExecutionNotification" as NSString as NSNotification.Name, object: self, userInfo: nil)
7676

7777
// Sleep for a while to let Xcode kill us.
7878
for _ in 1...10 {
@@ -116,7 +116,7 @@ public final class XCPlaygroundPage {
116116
userInfo = [:]
117117
}
118118

119-
NotificationCenter.default.post(name: "XCPlaygroundPageLiveViewDidChangeNotification" as NSNotification.Name, object: self, userInfo: userInfo)
119+
NotificationCenter.default.post(name: "XCPlaygroundPageLiveViewDidChangeNotification" as NSString as NSNotification.Name, object: self, userInfo: userInfo)
120120
}
121121
}
122122
}

0 commit comments

Comments
 (0)