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

# appendInterpolation(_:)

Appends an attributed substring to a string interpolation.

```
@export(implementation) mutating func appendInterpolation(_ attributedSubstring: AttributedSubstring)
```

## Parameters

`attributedSubstring`

The attributed substring to append.

## 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 an
<doc://com.apple.documentation/documentation/Foundation/AttributedSubstring>
and append it to static text. The resulting interpolation implicitly
creates a [`LocalizedStringKey`](/documentation/SwiftUI/LocalizedStringKey), which a [`Text`](/documentation/SwiftUI/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`](/documentation/SwiftUI/Text) view renders its contents:

---

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)