---
title: "commitInsertion(dataSourceUpdates:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicollectionviewdropplaceholdercontext/commitinsertion(datasourceupdates:)"
---

# commitInsertion(dataSourceUpdates:)

Exchanges the placeholder cell for a cell with the final content.

## Declaration

```swift
func commitInsertion(dataSourceUpdates: (IndexPath) -> Void) -> Bool
```

## Parameters

- `dataSourceUpdates`: The handler block to execute as part of committing your changes. Use this block to update your collection view’s data source with the actual data that you received. This block has no return value and takes the following parameter:

## Mentioned in

Supporting Drag and Drop in Collection Views

## Return Value

Return Value true if the placeholder was replaced by your content or false if the placeholder was no longer in the collection view.

## Discussion

Discussion When you receive the actual data for a cell, call this method to remove the corresponding placeholder cell and insert the actual cell. If the placeholder cell is still present in the collection view, this method calls the dataSourceUpdates handler. Use that handler block to update the data source object of the collection view. Do not update the collection view itself. This method automatically updates the collection view, creating a new cell for your data. If the placeholder cell is no longer present, this method does not execute your dataSourceUpdates block.

## See Also

### Updating the Placeholder Cell

- [setNeedsCellUpdate()](uikit/uicollectionviewdropplaceholdercontext/setneedscellupdate().md)
