File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,9 @@ extension String {
458458 #endif
459459 }
460460
461+ public init ( _ cocoaString: NSString ) {
462+ self = cocoaString. _storage
463+ }
461464}
462465
463466extension StringProtocol where Index == String . Index {
Original file line number Diff line number Diff line change @@ -1629,6 +1629,11 @@ class TestNSString: LoopbackServerTest {
16291629 }
16301630 }
16311631
1632+ func test_initStringWithNSString( ) {
1633+ let ns = NSString ( " Test " )
1634+ XCTAssertEqual ( String ( ns) , " Test " )
1635+ }
1636+
16321637 static var allTests : [ ( String , ( TestNSString ) -> ( ) throws -> Void ) ] {
16331638 var tests = [
16341639 ( " test_initData " , test_initData) ,
@@ -1701,6 +1706,7 @@ class TestNSString: LoopbackServerTest {
17011706 ( " test_fileSystemRepresentation " , test_fileSystemRepresentation) ,
17021707 ( " test_enumerateSubstrings " , test_enumerateSubstrings) ,
17031708 ( " test_paragraphRange " , test_paragraphRange) ,
1709+ ( " test_initStringWithNSString " , test_initStringWithNSString) ,
17041710 ]
17051711
17061712#if !os(Windows)
You can’t perform that action at this time.
0 commit comments