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
rdar://107955097 (FoundationPreview: Batch move string API (continued)) (#34)
* rdar://107955097 (FoundationPreview: Batch move string API (continued))
- Move localized uppercase and lowercase to FoundationLocalization
- if-def out of CharacterSet from FoundationPreview. It's not implemented at all there, and having a no-op stub is misleading
* rdar://107955097 (FoundationPreview: Batch move string API (continued))
- Move components separated by string and range of string functions
* rdar://107955097 (FoundationPreview: Batch move string API (continued))
Enable snake case options for JSON encoder and decoder. We haven't been able to enable this option because it needed `CharacterSet`, which hasn't been properly implemented for FoundationPreview. Now that we have `BuiltInUnicodeScalarSet`, which mirrors `CharacterSet`, we can switch to that and enable the options.
* rdar://107955097 (FoundationPreview: Batch move string API (continued))
- Move `StringProtocol.lineRange(for:)` and `paragraphRange(for:)` to FoundationEssentials
- Rename String+Regex.swift to RegexPatternCache.swift
- Consolidate extensions on various String family members and remove one redundant swift file
---------
Co-authored-by: I-Ting Tina Liu <iting_liu@apple.com>
Copy file name to clipboardExpand all lines: Sources/FoundationEssentials/JSON/JSONEncoder.swift
+3-9Lines changed: 3 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -117,12 +117,9 @@ open class JSONEncoder {
117
117
/// Use the keys specified by each type. This is the default strategy.
118
118
case useDefaultKeys
119
119
120
-
#if FOUNDATION_FRAMEWORK
121
-
// TODO: Reenable this option once String.rangeOfCharacter(from:) is moved
122
-
123
120
/// Convert from "camelCaseKeys" to "snake_case_keys" before writing a key to JSON payload.
124
121
///
125
-
/// Capital characters are determined by testing membership in `CharacterSet.uppercaseLetters` and `CharacterSet.lowercaseLetters` (Unicode General Categories Lu and Lt).
122
+
/// Capital characters are determined by testing membership in Unicode General Categories Lu and Lt.
126
123
/// The conversion to lower case uses `Locale.system`, also known as the ICU "root" locale. This means the result is consistent regardless of the current user's locale and language preferences.
127
124
///
128
125
/// Converting from camel case to snake case:
@@ -135,7 +132,6 @@ open class JSONEncoder {
135
132
///
136
133
/// - Note: Using a key encoding strategy has a nominal performance cost, as each string key has to be converted.
137
134
case convertToSnakeCase
138
-
#endif
139
135
140
136
/// Provide a custom conversion to the key in the encoded JSON from the keys specified by the encoded types.
141
137
/// The full path to the current encoding position is provided for context (in case you need to locate this key within the payload). The returned key is used in place of the last component in the coding path before encoding.
0 commit comments