<!--
{
  "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" : "Foundation",
  "identifier" : "/documentation/Foundation/NSItemProvider/registerFileRepresentation(for:visibility:openInPlace:loadHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So14NSItemProviderC22UniformTypeIdentifiersE26registerFileRepresentation3for10visibility11openInPlace11loadHandleryAC6UTTypeV_So0abH10VisibilityVSbSo10NSProgressCSgy10Foundation3URLVSg_Sbs5Error_pSgtcYbctF"
  },
  "title" : "registerFileRepresentation(for:visibility:openInPlace:loadHandler:)"
}
-->

# registerFileRepresentation(for:visibility:openInPlace:loadHandler:)

Registers a file-backed representation for an item with item visibility, an open-in-place option, and a load handler.

```
func registerFileRepresentation(for contentType: UTType, visibility: NSItemProviderRepresentationVisibility = .all, openInPlace: Bool = false, loadHandler: @escaping @Sendable (@escaping (URL?, Bool, (any Error)?) -> Void) -> Progress?)
```

## Discussion

If a destination app must access the represented file using a file coordinator, set the `coordinated` parameter in the load handler block to <doc://com.apple.documentation/documentation/Swift/true>.

To offer a representation backed by a file provider, return an [`NSURL`](/documentation/Foundation/NSURL) object that points to your app’s file provider’s container. The file provider extension is then invoked to retrieve the file when requested.

To offer a representation backed by a file to open in place, set the fileOptions parameter to a value of [`openInPlace`](/documentation/Foundation/NSItemProviderFileOptions/openInPlace); in addition, return an [`NSURL`](/documentation/Foundation/NSURL) object that points to your app’s file provider’s container. Open-in-place support requires that the file provider is visible in the Files app.

---

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)