protocol ExpressibleByStringLiteral
Inheritance |
ExpressibleByExtendedGraphemeClusterLiteral, ExpressibleByUnicodeScalarLiteral
View Protocol Hierarchy →
|
---|---|
Associated Types |
StringLiteralType : _ExpressibleByBuiltinStringLiteral
A type that represents a string literal. Valid types for |
Import | import Swift |
Initializers
Creates an instance initialized to the given string value.
value
: The value of the new instance.
Declaration
init(stringLiteral value: Self.StringLiteralType)
Creates an instance initialized to the given value.
value
: The value of the new instance.
Declaration
init(extendedGraphemeClusterLiteral value: Self.ExtendedGraphemeClusterLiteralType)
Declared In
ExpressibleByExtendedGraphemeClusterLiteral
Creates an instance initialized to the given value.
value
: The value of the new instance.
Declaration
init(unicodeScalarLiteral value: Self.UnicodeScalarLiteralType)
Declared In
ExpressibleByUnicodeScalarLiteral
Default Implementations
Where ExtendedGraphemeClusterLiteralType == StringLiteralType
Declaration
init(extendedGraphemeClusterLiteral value: Self.StringLiteralType)
Where ExtendedGraphemeClusterLiteralType == UnicodeScalarLiteralType
Creates an instance initialized to the given value.
value
: The value of the new instance.
Declaration
init(unicodeScalarLiteral value: Self.ExtendedGraphemeClusterLiteralType)
Declared In
ExpressibleByExtendedGraphemeClusterLiteral
A type that can be initialized with a string literal.
The
String
andStaticString
types conform to theExpressibleByStringLiteral
protocol. You can initialize a variable or constant of either of these types using a string literal of any length.Conforming to ExpressibleByStringLiteral
To add
ExpressibleByStringLiteral
conformance to your custom type, implement the required initializer.