<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FileProvider",
  "identifier" : "/documentation/FileProvider/NSFileProviderReplicatedExtension/modifyItem(_:baseVersion:changedFields:contents:options:request:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "File Provider"
    ],
    "preciseIdentifier" : "c:objc(pl)NSFileProviderReplicatedExtension(im)modifyItem:baseVersion:changedFields:contents:options:request:completionHandler:"
  },
  "title" : "modifyItem(_:baseVersion:changedFields:contents:options:request:completionHandler:)"
}
-->

# modifyItem(_:baseVersion:changedFields:contents:options:request:completionHandler:)

Tells the file provider that an item’s content or metadata changed.

```
func modifyItem(_ item: NSFileProviderItem, baseVersion version: NSFileProviderItemVersion, changedFields: NSFileProviderItemFields, contents newContents: URL?, options: NSFileProviderModifyItemOptions = [], request: NSFileProviderRequest, completionHandler: @escaping (NSFileProviderItem?, NSFileProviderItemFields, Bool, (any Error)?) -> Void) -> Progress
```

## Parameters

`item`

The item to modify.

`version`

The item’s version.

`changedFields`

The fields that have changed.

`newContents`

A URL for the local copy of the item’s new contents.

`options`

The modification options.

`request`

An object that identifies the context of that request, such as the requesting app.

`completionHandler`

A block that you call after uploading the changes to your remote storage. You pass the following parameters:

- `item`: The newly modified item.
- `stillPendingFields`: Any fields that you haven’t yet applied. If you can apply all the fields at once, pass an empty `NSFileProviderItemField` instance.
- `shouldFetchContent`: A Boolean value that indicates whether the system should fetch the item’s content from your remote storage.
- `error`: If an error occurs, this object contains information about the error; otherwise, it’s `nil`.

## Return Value

An item that tracks your extension’s progress.

## Discussion

The system calls this method when the user modifies an item—for example, moving it, renaming it, or updating its content. The `changedFields` parameter may contain multiple items, indicating that multiple changes have occurred. Update the version of the item in your remote storage to match, and then call the callback handler.

---

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)