<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreTransferable",
  "identifier" : "/documentation/CoreTransferable/FileRepresentation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Transferable"
    ],
    "preciseIdentifier" : "s:16CoreTransferable18FileRepresentationV"
  },
  "title" : "FileRepresentation"
}
-->

# FileRepresentation

A transfer representation for types that transfer as a file URL.

```
struct FileRepresentation<Item> where Item : Transferable
```

## Overview

Use a [`FileRepresentation`](/documentation/CoreTransferable/FileRepresentation) for transferring types
that involve a large amount of data.
For example, if your app defines a `Movie` type that could represent a lengthy video,
use a `FileRepresentation` instance
to transfer the video data to another app or process.

```
struct Movie: Transferable {
    let url: URL
    static var transferRepresentation: some TransferRepresentation {
        FileRepresentation(contentType: .mpeg4Movie) { movie in
            SentTransferredFile(movie.url)
        } importing: { received in
            let copy = URL(fileURLWithPath: "<#...#>")
            try FileManager.default.copyItem(at: received.file, to: copy)
            return Self(url: copy)
        }
    }
}
```

Note that the overall recommendation is to specify the content type
that describes the file content as close as possible. For example,
if you are sharing a PDF file, declare a [`FileRepresentation`](/documentation/CoreTransferable/FileRepresentation) of
a `UTType.pdf` content type, instead of `UTType.fileURL`
or `UTType.content` so the data can be dragged, shared, or imported
to apps that support that data type:

```
  struct PDFDocument: Transferable {
      var file: URL

      static var transferRepresentation: some TransferRepresentation {
          FileRepresentation(contentType: .pdf) { ...
          } importing: { ... }
      }
  }
```

It’s efficient to pass data around as a file and the receiver
loads it into memory only if it’s required.

## Topics

### Creating a transfer representation

[`init(contentType:shouldAttemptToOpenInPlace:exporting:importing:)`](/documentation/CoreTransferable/FileRepresentation/init(contentType:shouldAttemptToOpenInPlace:exporting:importing:))

Creates a transfer representation for importing and exporting
transferable items as files.

[`init(importedContentType:shouldAttemptToOpenInPlace:importing:)`](/documentation/CoreTransferable/FileRepresentation/init(importedContentType:shouldAttemptToOpenInPlace:importing:))

Creates a transfer representation for importing transferable items as files.

[`init(exportedContentType:shouldAllowToOpenInPlace:exporting:)`](/documentation/CoreTransferable/FileRepresentation/init(exportedContentType:shouldAllowToOpenInPlace:exporting:))

Creates a transfer representation for exporting transferable items as files.

### Implementing a transfer representation

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`TransferRepresentation`](/documentation/CoreTransferable/TransferRepresentation)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)