---
title: AttributedTextFormatting.Transferable
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/attributedtextformatting/transferable
---

# AttributedTextFormatting.Transferable

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

## Declaration

```swift
struct Transferable
```

## Overview

Overview Use this type e.g. with drag and drop APIs or to create a fileExporter(isPresented:item:contentTypes:defaultFilename:onCompletion:onCancellation:). struct RichTextEditorView: View {     @State private var text: AttributedString = ""     @Environment(\.self) private var environment     @State var fileExporterIsPresented: Bool = false

var body: some View {         TextEditor(text: $text)             .toolbar {                 Button("Save") {                     fileExporterIsPresented = true                 }             }             .fileExporter(                 isPresented: $fileExporterIsPresented,                 item: AttributedTextFormatting.Transferable(text: text, in: environment)             ) { result in                 handleResult(result)             }             .dropDestination(                 for: AttributedTextFormatting.Transferable.self             ) { transferables, _ in                 text.replaceSelection(                     &selection,                     with: transferables.map {                         AttributedString(transferable: $0, in: environment)                     }.joined(separator: AttributedString("\n")))                 return true             }     } } To extract text the text after importing, use attributed string’s Foundation/AttributedString/init(transferable:in:). Supported content types include: rtfd rtf

## Topics

### Initializers

- [init(text:in:)](swiftui/attributedtextformatting/transferable/init(text:in:).md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Transferable](coretransferable/transferable.md)
