---
title: FileRepresentation
framework: coretransferable
role: symbol
role_heading: Structure
path: coretransferable/filerepresentation
---

# FileRepresentation

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

## Declaration

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

## Mentioned in

Choosing a transfer representation for a model type

## Overview

Overview Use a 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 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:)](coretransferable/filerepresentation/init(contenttype:shouldattempttoopeninplace:exporting:importing:).md)
- [init(importedContentType:shouldAttemptToOpenInPlace:importing:)](coretransferable/filerepresentation/init(importedcontenttype:shouldattempttoopeninplace:importing:).md)
- [init(exportedContentType:shouldAllowToOpenInPlace:exporting:)](coretransferable/filerepresentation/init(exportedcontenttype:shouldallowtoopeninplace:exporting:).md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [TransferRepresentation](coretransferable/transferrepresentation.md)

## See Also

### File transfer

- [SentTransferredFile](coretransferable/senttransferredfile.md)
- [ReceivedTransferredFile](coretransferable/receivedtransferredfile.md)
