---
title: "init(text:in:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/attributedtextformatting/transferable/init(text:in:)"
---

# init(text:in:)

Create a transferable representation of an attributed string as interpreted in a SwiftUI environment.

## Declaration

```swift
init(text: AttributedString, in environment: EnvironmentValues)
```

## Discussion

Discussion When exporting the text into different data formats, the transfer representation may use the given environment to resolve semantic attribute values, such as certain colors or fonts to concrete values. This means that depending on the representation used during transfer, some semantic information may be lost in that step. note: The transferable representation applies the AttributedTextFormattingDefinition in the environment before exporting the content. note: View/attributedTextFormattingDefinition(_:)-uc57, AttributedTextValueConstraint/constrain(_:)-6cp64
