Protocolswift 6.0.1Swift
ExpressibleByExtendedGraphemeClusterLiteral
A type that can be initialized with a string literal containing a single extended grapheme cluster.
protocol ExpressibleByExtendedGraphemeClusterLiteral : ExpressibleByUnicodeScalarLiteral
An extended grapheme cluster is a group of one or more Unicode scalar values that approximates a single user-perceived character. Many individual characters, such as “é”, “김”, and “🇮🇳”, can be made up of multiple Unicode scalar values. These code points are combined by Unicode’s boundary algorithms into extended grapheme clusters.
The String
, StaticString
, and Character
types conform to the ExpressibleByExtendedGraphemeClusterLiteral
protocol. You can initialize a variable or constant of any of these types using a string literal that holds a single character.
let snowflake: Character = "❄︎"
print(snowflake)
// Prints "❄︎"
Conforming to ExpressibleByExtendedGraphemeClusterLiteral
To add ExpressibleByExtendedGraphemeClusterLiteral
conformance to your custom type, implement the required initializer.
Supertypes
protocol ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single Unicode scalar value.
Requirements
Type members
associatedtype ExtendedGraphemeClusterLiteralType
A type that represents an extended grapheme cluster literal.
init(extendedGraphemeClusterLiteral: Self.ExtendedGraphemeClusterLiteralType
) Creates an instance initialized to the given value.
Citizens in Swift
Subtypes
protocol ExpressibleByStringInterpolation
A type that can be initialized by string interpolation with a string literal that includes expressions.
protocol ExpressibleByStringLiteral
A type that can be initialized with a string literal.
protocol StringProtocol
A type that can represent a string as a collection of characters.
Citizens in Swift
where Self.ExtendedGraphemeClusterLiteralType == Self.UnicodeScalarLiteralType