Appends a timer interval to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- timerInterval: The interval between where to run the timer.
- pauseTime: If present, the date at which to pause the timer.
The default is `nil` which indicates to never pause.
- countsDown: Whether to count up or down. The default is `true`.
- showsHours: Whether to include an hours component if there are
more than 60 minutes left on the timer. The default is `true`.
Appends a localized description of a color for accessibility
to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- color: the color being described.
Appends a formatted date to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- date: The date to append.
- style: A predefined style to format the date with.
Appends an optionally-formatted instance of a Foundation type
to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- subject: The Foundation object to append.
- formatter: A formatter to convert `subject` to a string
representation.
Appends an optionally-formatted instance of an Objective-C subclass
to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
The following example shows how to use a
<doc://com.apple.documentation/documentation/Foundation/Measurement>
value and a
<doc://com.apple.documentation/documentation/Foundation/MeasurementFormatter>
to create a ``LocalizedStringKey`` that uses the formatter
style
<doc://com.apple.documentation/documentation/foundation/Formatter/UnitStyle/long>
when generating the measurement's string representation. Rather than
calling `appendInterpolation(_:formatter)` directly, the code
gets the formatting behavior implicitly by using the `\()`
string interpolation syntax.
let siResistance = Measurement(value: 640, unit: UnitElectricResistance.ohms)
let formatter = MeasurementFormatter()
formatter.unitStyle = .long
let key = LocalizedStringKey ("Resistance: \(siResistance, formatter: formatter)")
let text1 = Text(key) // Text contains "Resistance: 640 ohms"
- Parameters:
- subject: An <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class>
to append.
- formatter: A formatter to convert `subject` to a string
representation.
Appends an attributed string to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
The following example shows how to use a string interpolation to
format an
<doc://com.apple.documentation/documentation/Foundation/AttributedString>
and append it to static text. The resulting interpolation implicitly
creates a ``LocalizedStringKey``, which a ``Text`` view uses to provide
its content.
struct ContentView: View {
var nextDate: AttributedString {
var result = Calendar.current
.nextWeekend(startingAfter: Date.now)!
.start
.formatted(
.dateTime
.month(.wide)
.day()
.attributed
)
result.backgroundColor = .green
result.foregroundColor = .white
return result
}
var body: some View {
Text("Our next catch-up is on \(nextDate)!")
}
}
For this example, assume that the app runs on a device set to a
Russian locale, and has the following entry in a Russian-localized
`Localizable.strings` file:
"Our next catch-up is on %@!" = "Наша следующая встреча состоится %@!";
The attributed string `nextDate` replaces the format specifier
`%@`, maintaining its color and date-formatting attributes, when
the ``Text`` view renders its contents:

- Parameter attributedString: The attributed string to append.
Appends the localized string resource to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- resource: The localized string resource to append.
Appends a date interval to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameter interval: The date interval to append.
Appends an attributed substring to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
The following example shows how to use a string interpolation to
format an
<doc://com.apple.documentation/documentation/Foundation/AttributedSubstring>
and append it to static text. The resulting interpolation implicitly
creates a ``LocalizedStringKey``, which a ``Text`` view uses to provide
its content.
struct ContentView: View {
var identificationNumberSuffix: AttributedSubstring {
// …
}
var body: some View {
Text("Identification: •••• •••• \(identificationNumberSuffix)!")
}
}
For this example, assume that the app runs on a device set to a
Russian locale, and has the following entry in a Russian-localized
`Localizable.strings` file:
"Identification: •••• •••• %@" = "Идентификация: •••• •••• %@";
The attributed string `identificationNumberSuffix` replaces the format specifier
`%@`, maintaining its color attributes, when
the ``Text`` view renders its contents:
- Parameter attributedSubstring: The attributed substring to append.
method · iOS 14.0+
appendInterpolation
TypeScript
appendInterpolation32465(text: Text): void
Swift declaration
mutating func appendInterpolation(_ text: Text)
Appends the string displayed by a text view to a string
interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- text: A ``Text`` instance to append.
method · iOS 14.0+
appendInterpolation
TypeScript
appendInterpolation17910(image: Image): void
Swift declaration
mutating func appendInterpolation(_ image: Image)
Appends an image to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameter image: The image to append.
Appends a date range to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameter dates: The closed range of dates to append.
Appends a literal string segment to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameter string: The literal string to append.
Appends a literal string segment to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameter substring: The interpolated substring to append.
Appends a type, convertible to a string by using a default format
specifier, to a string interpolation.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameters:
- value: A primitive type to append, such as
<doc://com.apple.documentation/documentation/swift/Int>,
<doc://com.apple.documentation/documentation/swift/UInt32>, or
<doc://com.apple.documentation/documentation/swift/Double>.
method · iOS 13.0+
appendLiteral
TypeScript
appendLiteral(literal: string): void
Swift declaration
mutating func appendLiteral(_ literal: String)
Appends a literal string.
Don't call this method directly; it's used by the compiler when
interpreting string interpolations.
- Parameter literal: The literal string to append.
Creates an empty instance ready to be filled with string literal content.
Don't call this initializer directly. Instead, initialize a variable or
constant using a string literal with interpolated expressions.
Swift passes this initializer a pair of arguments specifying the size of
the literal segments and the number of interpolated segments. Use this
information to estimate the amount of storage you will need.
- Parameter literalCapacity: The approximate size of all literal segments
combined. This is meant to be passed to `String.reserveCapacity(_:)`;
it may be slightly larger or smaller than the sum of the counts of each
literal segment.
- Parameter interpolationCount: The number of interpolations which will be
appended. Use this value to estimate how much additional capacity will
be needed for the interpolated segments.
Skipped declarations
6 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.