struct StaticString A string type designed to represent text that is known at compile time. Instances of the StaticString type are immutable. StaticString provides limited, pointer-based access to its contents, unlike Swift's more commonly used String type. A static string can store its value as a pointer to an ASCII code unit sequence, as a pointer to a UTF-8 code unit sequence, or as a single Unicode scalar value. Inheritance CustomDebugStringConvertible, CustomReflectable, CustomStringConvertible, ExpressibleByExtendedGraphemeClusterLiteral, ExpressibleByStringLiteral, ExpressibleByUnicodeScalarLiteral View Protocol Hierarchy → Import import Swift Initializers init() Creates an empty static string. Declaration init() init(extendedGraphemeClusterLiteral:) Creates an instance initialized to a single character that is made up of one or more Unicode code points. Do not call this initializer directly. It may be used by the compiler when you initialize a static string using an extended grapheme cluster. Declaration init(extendedGraphemeClusterLiteral value: StaticString) init(stringLiteral:) Creates an instance initialized to the value of a string literal. Do not call this initializer directly. It may be used by the compiler when you initialize a static string using a string literal. Declaration init(stringLiteral value: StaticString) init(unicodeScalarLiteral:) Creates an instance initialized to a single Unicode scalar. Do not call this initializer directly. It may be used by the compiler when you initialize a static string with a Unicode scalar. Declaration init(unicodeScalarLiteral value: StaticString) Instance Variables var customMirror: Mirror The custom mirror for this instance. If this type has value semantics, the mirror should be unaffected by subsequent mutations of the instance. Declaration var customMirror: Mirror { get } var debugDescription: String A textual representation of the static string, suitable for debugging. Declaration var debugDescription: String { get } var description: String A string representation of the static string. Declaration var description: String { get } var hasPointerRepresentation: Bool A Boolean value indicating whether the static string stores a pointer to ASCII or UTF-8 code units. Declaration var hasPointerRepresentation: Bool { get } var isASCII: Bool A Boolean value that is true if the static string stores a pointer to ASCII code units. Use this property in conjunction with hasPointerRepresentation to determine whether a static string with pointer representation stores an ASCII or UTF-8 code unit sequence. Warning: If the static string stores a single Unicode scalar value, the value of isASCII is unspecified. Declaration var isASCII: Bool { get } var unicodeScalar: UnicodeScalar The stored Unicode scalar value. The static string must store a single Unicode scalar value. Accessing this property when hasPointerRepresentation is true triggers a runtime error. Declaration var unicodeScalar: UnicodeScalar { get } var utf8CodeUnitCount: Int The length in bytes of the static string's ASCII or UTF-8 representation. Warning: If the static string stores a single Unicode scalar value, the value of utf8CodeUnitCount is unspecified. Declaration var utf8CodeUnitCount: Int { get } var utf8Start: UnsafePointer<UInt8> A pointer to the beginning of the string's UTF-8 encoded representation. The static string must store a pointer to either ASCII or UTF-8 code units. Accessing this property when hasPointerRepresentation is false triggers a runtime error. Declaration var utf8Start: UnsafePointer<UInt8> { get } Instance Methods func withUTF8Buffer(_:) Invokes the given closure with a buffer containing the static string's UTF-8 code unit sequence. This method works regardless of whether the static string stores a pointer or a single Unicode scalar value. body: A closure that takes a buffer pointer to the static string's UTF-8 code unit sequence as its sole argument. If the closure has a return value, it is used as the return value of the withUTF8Buffer(invoke:) method. Returns: The return value of the body closure, if any. Declaration func withUTF8Buffer<R>(_ body: (UnsafeBufferPointer<UInt8>) -> R) -> R