Skip to content

Commit cb70fdc

Browse files
committed
Add missing NSNotification.Name.init(_:)
1 parent 3cd1f79 commit cb70fdc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Foundation/NSNotification.swift

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
open class NSNotification: NSObject, NSCopying, NSCoding {
1111
public struct Name : RawRepresentable, Equatable, Hashable {
1212
public private(set) var rawValue: String
13+
14+
public init(_ rawValue: String) {
15+
self.rawValue = rawValue
16+
}
17+
1318
public init(rawValue: String) {
1419
self.rawValue = rawValue
1520
}

TestFoundation/TestNotification.swift

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class TestNotification : XCTestCase {
1212
static var allTests: [(String, (TestNotification) -> () throws -> Void)] {
1313
return [
1414
("test_customReflection", test_customReflection),
15+
("test_NotificationNameInit", test_NotificationNameInit),
1516
]
1617
}
1718

@@ -41,4 +42,8 @@ class TestNotification : XCTestCase {
4142

4243
}
4344

45+
func test_NotificationNameInit() {
46+
let name = "TestNotificationNameInit"
47+
XCTAssertEqual(Notification.Name(name), Notification.Name(rawValue: name))
48+
}
4449
}

0 commit comments

Comments
 (0)