File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,9 @@ extension String {
458
458
#endif
459
459
}
460
460
461
+ public init ( _ cocoaString: NSString ) {
462
+ self = cocoaString. _storage
463
+ }
461
464
}
462
465
463
466
extension StringProtocol where Index == String . Index {
Original file line number Diff line number Diff line change @@ -1629,6 +1629,11 @@ class TestNSString: LoopbackServerTest {
1629
1629
}
1630
1630
}
1631
1631
1632
+ func test_initStringWithNSString( ) {
1633
+ let ns = NSString ( " Test " )
1634
+ XCTAssertEqual ( String ( ns) , " Test " )
1635
+ }
1636
+
1632
1637
static var allTests : [ ( String , ( TestNSString ) -> ( ) throws -> Void ) ] {
1633
1638
var tests = [
1634
1639
( " test_initData " , test_initData) ,
@@ -1701,6 +1706,7 @@ class TestNSString: LoopbackServerTest {
1701
1706
( " test_fileSystemRepresentation " , test_fileSystemRepresentation) ,
1702
1707
( " test_enumerateSubstrings " , test_enumerateSubstrings) ,
1703
1708
( " test_paragraphRange " , test_paragraphRange) ,
1709
+ ( " test_initStringWithNSString " , test_initStringWithNSString) ,
1704
1710
]
1705
1711
1706
1712
#if !os(Windows)
You can’t perform that action at this time.
0 commit comments