.makeIterator()
var scalars: [UnicodeScalar] = []
var utf8Decoder = UTF8()
Decode: while true {
    switch utf8Decoder.decode(&amp;bytesIterator) {
    case .scalarValue(let v): scalars.append(v)
    case .emptyInput: break Decode
    case .error:
        print(&quot;Decoding error&quot;)
        break Decode
    }
}
print(scalars)
// Prints &quot;[&quot;\u{2728}&quot;, &quot;U&quot;, &quot;n&quot;, &quot;i&quot;, &quot;c&quot;, &quot;o&quot;, &quot;d&quot;, &quot;e&quot;, &quot;\u{2728}&quot;]&quot;</code>