Instance Method インスタンスメソッド

appendInterpolation(_:format:)

Appends the formatted representation of a nonstring type supported by a corresponding format style.

Declaration 宣言

mutating func appendInterpolation<F>(_ input: F.FormatInput, format: F) where F : FormatStyle, F.FormatInput : Equatable, F.FormatOutput == String

Parameters パラメータ

input

The instance to format and append.

format

A format style to use when converting input into a string representation.

Discussion 議論

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 a Date with a Date.FormatStyle and append it to static text. The resulting interpolation implicitly creates a LocalizedStringKey, which a Text uses to provide its content.


Text("The time is \(myDate, format: Date.FormatStyle(date: .omitted, time:.complete))")

See Also 参照

Appending to an Interpolation