UnicodeCodec
A Unicode encoding form that translates between Unicode scalar values and form-specific code units.
protocol UnicodeCodec : _UnicodeEncoding
The UnicodeCodec
protocol declares methods that decode code unit sequences into Unicode scalar values and encode Unicode scalar values into code unit sequences. The standard library implements codecs for the UTF-8, UTF-16, and UTF-32 encoding schemes as the UTF8
, UTF16
, and UTF32
types, respectively. Use the Unicode.Scalar
type to work with decoded Unicode scalar values.
Requirements
init(
) Creates an instance of the codec.
static func encode(Unicode
.Scalar, into: (Self.CodeUnit) -> Void) Encodes a Unicode scalar as a series of code units by calling the given closure on each code unit.
func decode<I>(inout I
) -> UnicodeDecodingResult Starts or continues decoding a code unit sequence into Unicode scalar values.