---
title: "dequeueReusableCell(withIdentifier:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableview/dequeuereusablecell(withidentifier:for:)"
---

# dequeueReusableCell(withIdentifier:for:)

Returns a reusable table-view cell object for the specified reuse identifier and adds it to the table.

## Declaration

```swift
func dequeueReusableCell(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCell
```

## Parameters

- `identifier`: A string identifying the cell object to be reused. This parameter must not be nil.
- `indexPath`: The index path specifying the location of the cell. Always specify the index path provided to you by your data source object. This method uses the index path to perform additional configuration based on the cell’s position in the table view.

## Mentioned in

Configuring the cells for your table Filling a table with data

## Return Value

Return Value A UITableViewCell object with the associated reuse identifier. This method always returns a valid cell.

## Discussion

Discussion Call this method only from the tableView(_:cellForRowAt:) method of your table view data source object. This method returns an existing cell of the specified type, if one is available, or it creates and returns a new cell using the class or storyboard you provided earlier. Don’t call this method outside of your data source’s tableView(_:cellForRowAt:) method. If you need to create cells at other times, call dequeueReusableCell(withIdentifier:) instead. important: You must specify a cell with a matching identifier in your storyboard file. You may also register a class or nib file using the register(_:forCellReuseIdentifier:) or register(_:forCellReuseIdentifier:) method, but must do so before calling this method. When creating new cells from your storyboard or nib file, this method loads the cell object and initializes it using its init(coder:) method. When creating cells from a registered class, this method creates the cell and initializes it by calling its init(style:reuseIdentifier:) method. For nib-based cells, this method loads the cell object from the provided nib file. If an existing cell was available for reuse, this method calls the cell’s prepareForReuse() method instead.

## See Also

### Recycling table view cells

- [register(_:forCellReuseIdentifier:)](uikit/uitableview/register(_:forcellreuseidentifier:)-5q6bo.md)
- [register(_:forCellReuseIdentifier:)](uikit/uitableview/register(_:forcellreuseidentifier:)-3l3ct.md)
- [dequeueReusableCell(withIdentifier:)](uikit/uitableview/dequeuereusablecell(withidentifier:).md)
