---
title: "applySnapshot(_:animatingDifferences:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableviewdiffabledatasourcereference/applysnapshot(_:animatingdifferences:)"
---

# applySnapshot(_:animatingDifferences:)

Updates the UI to reflect the state of the data in the snapshot, optionally animating the UI changes.

## Declaration

```swift
func applySnapshot(_ snapshot: NSDiffableDataSourceSnapshotReference, animatingDifferences: Bool)
```

## Parameters

- `snapshot`: The snapshot that reflects the new state of the data in the table view.
- `animatingDifferences`: If doc://com.apple.documentation/documentation/Swift/true, the system animates the updates to the table view. If doc://com.apple.documentation/documentation/Swift/false, the system doesn’t animate the updates to the table view.

## Discussion

Discussion The diffable data source computes the difference between the table view’s current state and the new state in the applied snapshot, which is an O(n) operation, where n is the number of items in the snapshot. You can safely call this method from a background queue, but you must do so consistently in your app. Always call this method exclusively from the main queue or from a background queue.

## See Also

### Updating data

- [snapshot()](uikit/uitableviewdiffabledatasourcereference/snapshot().md)
- [applySnapshot(_:animatingDifferences:completion:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(_:animatingdifferences:completion:).md)
- [applySnapshot(usingReloadData:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(usingreloaddata:).md)
- [applySnapshot(usingReloadData:completion:)](uikit/uitableviewdiffabledatasourcereference/applysnapshot(usingreloaddata:completion:).md)
- [defaultRowAnimation](uikit/uitableviewdiffabledatasourcereference/defaultrowanimation.md)
