<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/LocalizedStringKey/StringInterpolation/appendInterpolation(_:format:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI18LocalizedStringKeyV0D13InterpolationV06appendF0_6formaty11FormatInputQz_xt10Foundation0I5StyleRzSQAIRQAJ010AttributedD0V0I6OutputRtzlF::OverloadGroup"
  },
  "title" : "appendInterpolation(_:format:)"
}
-->

# appendInterpolation(_:format:)

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

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

## Parameters

`input`

The instance to format and append.

`format`

A format style to use when converting `input` into an attributed
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
<doc://com.apple.documentation/documentation/Foundation/Date>
with a
<doc://com.apple.documentation/documentation/Foundation/Date/FormatStyle> and
append it to static text. The resulting interpolation implicitly
creates a [`LocalizedStringKey`](/documentation/SwiftUI/LocalizedStringKey), which a [`Text`](/documentation/SwiftUI/Text) uses to provide
its content.

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)