You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parity: NSCoding: ByteCountFormatter, failWithError(_:) & ObjC API Notes compatibility.
Implementation of:
- ByteCountFormatter’s NSCoding methods;
- Tests, adding a macOS fixture;
- Fixtures can now support types that do not support secure coding;
- Re-enable failWithError(_:) to just log;
- NSStringFromClass and NSClassFromString now have a mapping from swift-corelibs-foundation types to ObjC names, meaning that e.g. NSClassFromString(“NSTask”) will return SwiftFoundation.Process.self and NSStringFromClass(SwiftFoundation.Process.self) will return “NSTask”. This is required for unarchiving formatters (since ByteCountFormatter is “NSByteCountFormatter”, Formatter is “NSFormatter” in archives.)
// The following have true as their default values, so check and write the reverse sense
94
+
if !self.allowsNonnumericFormatting {
95
+
coder.encode(true, forKey:"NSNoNonnumeric")
96
+
}
97
+
if !self.includesUnit {
98
+
coder.encode(true, forKey:"NSNoUnit")
99
+
}
100
+
if !self.includesCount {
101
+
coder.encode(true, forKey:"NSNoCount")
102
+
}
103
+
if !self.isAdaptive {
104
+
coder.encode(true, forKey:"NSNoAdaptive")
105
+
}
49
106
}
50
107
51
108
/* Specify the units that can be used in the output. If ByteCountFormatter.Units is empty, uses platform-appropriate settings; otherwise will only use the specified units. This is the default value. Note that ZB and YB cannot be covered by the range of possible values, but you can still choose to use these units to get fractional display ("0.0035 ZB" for instance).
Copy file name to clipboardExpand all lines: Foundation/NSObjCRuntime.swift
+122-1Lines changed: 122 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -228,6 +228,118 @@ internal struct _CFInfo {
228
228
}
229
229
}
230
230
231
+
// MARK: Classes to strings
232
+
233
+
// These must remain in sync with Foundation.apinotes as shipped on Apple OSes.
234
+
// NSStringFromClass(_:) will return the ObjC name when passed one of these classes, and NSClassFromString(_:) will return the class when passed the ObjC name.
235
+
// This is important for NSCoding archives created on Apple OSes to decode with swift-corelibs-foundation and for general source and data format compatibility.
0 commit comments