Unicode.Scalar
A Unicode scalar value.
Declaration
@frozen struct ScalarOverview
The Unicode.Scalar type, representing a single Unicode scalar value, is the element type of a string’s unicodeScalars collection.
You can create a Unicode.Scalar instance by using a string literal that contains a single character representing exactly one Unicode scalar value.
let letterK: Unicode.Scalar = "K"
let kim: Unicode.Scalar = "김"
print(letterK, kim)
// Prints "K 김"You can also create Unicode scalar values directly from their numeric representation.
let airplane = Unicode.Scalar(9992)!
print(airplane)
// Prints "✈︎"Topics
Creating a Scalar
Inspecting a Scalar
Printing and Displaying a Scalar
descriptionwrite(to:)escaped(asASCII:)utf16Unicode.Scalar.UTF16ViewdebugDescriptioncustomMirrorcustomPlaygroundQuickLook
Comparing Scalars
Creating Ranges of Scalars
Structures
Instance Properties
Type Aliases
Default Implementations
Comparable ImplementationsCustomDebugStringConvertible ImplementationsCustomReflectable ImplementationsCustomStringConvertible ImplementationsEquatable ImplementationsExpressibleByUnicodeScalarLiteral ImplementationsHashable ImplementationsLosslessStringConvertible ImplementationsTextOutputStreamable Implementations