Tutorial 2, 5th Edition: dequeueReusableCell: multiple forms

open func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell? // Used by the delegate to acquire an already allocated cell, in lieu of allocating a new one.

@available(iOS 6.0, *)
open func dequeueReusableCell(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCell // newer dequeue method guarantees a cell is returned and resized properly, assuming identifier is registered

dequeueReusableCell has two signatures. One might not return anything and the other always will. The tutorial used the second form.

Why would that form care which data row (indexPath) will be used to populate the cell’s contents?

The one that takes the indexPath parameter is really the preferred way has been since iOS 6. To be honest, I’m not sure why the UITableView cares about the index-path. There is probably a good reason for it. :smiley: Just know that this is the API you’re supposed to use instead of the older version.

I’m pretty sure that it will call “heightForRowAt” with the indexPath, so it can adjust the height of the cell, in case you are dynamically changing the height for different rows.