<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AttributedString/init(transferable:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation16AttributedStringV7SwiftUIE12transferable2inAcD0B14TextFormattingOADE12TransferableV_AD17EnvironmentValuesVtKcfc"
  },
  "title" : "init(transferable:in:)"
}
-->

# init(transferable:in:)

Extract an attributed string from SwiftUI’s transferable representation
in a certain environment.

```
init(transferable: AttributedTextFormatting.Transferable, in environment: EnvironmentValues) throws
```

## Discussion

Use this initializer with a `AttributedTextFormatting/Transferable`
that was imported, e.g. in the `action` closure of the
`View/dropDestination(for:action:isTargeted)` modifier.

> Note: This initializer applies the
> ``AttributedTextFormattingDefinition`` in the given `environment` to the
> imported text before returning.

> SeeAlso: ``View/attributedTextFormattingDefinition(_:)-uc57``,
> ``AttributedTextValueConstraint/constrain(_:)-6cp64``

---

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)