Generic Initializer

init(decoding:as:)

Creates a string from the given Unicode code units in the specified encoding.

Required.

Declaration

init<C, Encoding>(decoding codeUnits: C, as sourceEncoding: Encoding.Type) where C : Collection, Encoding : _UnicodeEncoding, C.Element == Encoding.CodeUnit

Parameters

codeUnits

A collection of code units encoded in the encoding specified in sourceEncoding.

sourceEncoding

The encoding in which codeUnits should be interpreted.