Instance Method


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


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



A string identifying the cell object to be reused. This parameter must not be nil.


The index path specifying the location of the cell. The data source receives this information when it is asked for the cell and should just pass it along. This method uses the index path to perform additional configuration based on the cell’s position in the table view.

Return Value

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


For performance reasons, a table view’€™s data source should generally reuse UITableViewCell objects when it assigns cells to rows in its tableView(_:cellForRowAt:) method. A table view maintains a queue or list of UITableViewCell objects that the data source has marked for reuse. Call this method from your data source object when asked to provide a new cell for the table view. This method dequeues an existing cell if one is available, or creates a new one based on the class or nib file you previously registered, and adds it to the table.

If you registered a class for the specified identifier and a new cell must be created, this method initializes the cell 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

Creating Table View Cells

func register(UINib?, forCellReuseIdentifier: String)

Registers a nib object containing a cell with the table view under a specified identifier.

func register(AnyClass?, forCellReuseIdentifier: String)

Registers a class for use in creating new table cells.

func dequeueReusableCell(withIdentifier: String) -> UITableViewCell?

Returns a reusable table-view cell object located by its identifier.