docs/Classes/URLEncodedFormEncoder/KeyEncoding.html
public enum KeyEncoding
Encoding to use for keys.
This type is derived from JSONEncoder‘s KeyEncodingStrategy and XMLEncoders KeyEncodingStrategy.
`
useDefaultKeys
`
Use the keys specified by each type. This is the default encoding.
Swift
case useDefaultKeys
`
convertToSnakeCase
`
Convert from “camelCaseKeys” to “snake_case_keys” before writing a key.
Capital characters are determined by testing membership in CharacterSet.uppercaseLetters and CharacterSet.lowercaseLetters (Unicode General Categories Lu and Lt). 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.
Converting from camel case to snake case:
_ between words_.For example, oneTwoThree becomes one_two_three. _oneTwoThree_ becomes _one_two_three_.
Note
Using a key encoding strategy has a nominal performance cost, as each string key has to be converted.
Swift
case convertToSnakeCase
`
convertToKebabCase
`
Same as convertToSnakeCase, but using - instead of _. For example oneTwoThree becomes one-two-three.
Swift
case convertToKebabCase
`
capitalized
`
Capitalize the first letter only. For example oneTwoThree becomes OneTwoThree.
Swift
case capitalized
`
uppercased
`
Uppercase all letters. For example oneTwoThree becomes ONETWOTHREE.
Swift
case uppercased
`
lowercased
`
Lowercase all letters. For example oneTwoThree becomes onetwothree.
Swift
case lowercased
`
custom(_:)
`
A custom encoding using the provided closure.
Swift
case custom((String) -> String)