@@ -18,6 +18,7 @@ extension unichar {
18
18
}
19
19
}
20
20
21
+ #if !os(WASI)
21
22
/// Returns a localized string, using the main bundle if one is not specified.
22
23
public
23
24
func NSLocalizedString( _ key: String ,
@@ -27,6 +28,7 @@ func NSLocalizedString(_ key: String,
27
28
comment: String ) -> String {
28
29
return bundle. localizedString ( forKey: key, value: value, table: tableName)
29
30
}
31
+ #endif
30
32
31
33
internal let kCFStringEncodingMacRoman = CFStringBuiltInEncodings . macRoman. rawValue
32
34
internal let kCFStringEncodingWindowsLatin1 = CFStringBuiltInEncodings . windowsLatin1. rawValue
@@ -237,7 +239,7 @@ open class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSC
237
239
internal init ( _ string: String ) {
238
240
_storage = string
239
241
}
240
-
242
+
241
243
public convenience required init ? ( coder aDecoder: NSCoder ) {
242
244
guard aDecoder. allowsKeyedCoding else {
243
245
preconditionFailure ( " Unkeyed coding is unsupported. " )
@@ -292,11 +294,11 @@ open class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSC
292
294
characters. deallocate ( )
293
295
return result
294
296
}
295
-
297
+
296
298
public static var supportsSecureCoding : Bool {
297
299
return true
298
300
}
299
-
301
+
300
302
open func encode( with aCoder: NSCoder ) {
301
303
if let aKeyedCoder = aCoder as? NSKeyedArchiver {
302
304
aKeyedCoder. _encodePropertyList ( self , forKey: " NS.string " )
@@ -1268,6 +1270,7 @@ extension NSString {
1268
1270
data = mData
1269
1271
}
1270
1272
1273
+ #if !os(WASI)
1271
1274
internal func _writeTo( _ url: URL , _ useAuxiliaryFile: Bool , _ enc: UInt ) throws {
1272
1275
var data = Data ( )
1273
1276
try _getExternalRepresentation ( & data, url, enc)
@@ -1281,6 +1284,7 @@ extension NSString {
1281
1284
open func write( toFile path: String , atomically useAuxiliaryFile: Bool , encoding enc: UInt ) throws {
1282
1285
try _writeTo ( URL ( fileURLWithPath: path) , useAuxiliaryFile, enc)
1283
1286
}
1287
+ #endif
1284
1288
1285
1289
public convenience init ( charactersNoCopy characters: UnsafeMutablePointer < unichar > , length: Int , freeWhenDone freeBuffer: Bool ) /* "NoCopy" is a hint */ {
1286
1290
// ignore the no-copy-ness
@@ -1365,6 +1369,7 @@ extension NSString {
1365
1369
}
1366
1370
}
1367
1371
1372
+ #if !os(WASI)
1368
1373
public convenience init ( contentsOf url: URL , encoding enc: UInt ) throws {
1369
1374
let readResult = try NSData ( contentsOf: url, options: [ ] )
1370
1375
@@ -1452,6 +1457,7 @@ extension NSString {
1452
1457
public convenience init ( contentsOfFile path: String , usedEncoding enc: UnsafeMutablePointer < UInt > ? ) throws {
1453
1458
try self . init ( contentsOf: URL ( fileURLWithPath: path) , usedEncoding: enc)
1454
1459
}
1460
+ #endif
1455
1461
}
1456
1462
1457
1463
extension NSString : ExpressibleByStringLiteral { }
0 commit comments