0

I'm currently going through a tutorial on UITableView. While learning I'm attempting to understand how the UITableView should be constructed by following Apple's documentation and its programming guides. In the tutorial, the developer places the dequeueReusableCell(withIdentifier:) method inside of the tableView(_:cellForRowAt:) method which belongs to the datasource. As a newcomer after reading Apple's references and guides, I would not have guessed that the dequeueReusableCell(withIdentifier:) method goes inside of the tableView(_:cellForRowAt:) method. As a developer, how do you pick up on subtle things like this? Is it because the tableView(_:cellForRowAt:) method returns a UITableViewCell and may be the best place to do UITableViewCell configurations?

I'd like to gain a better understanding of Apple's references for future projects, thank you in advance for any comments or answers.

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", for: indexPath)

        return cell

}
nynohu
  • 1,628
  • 12
  • 12
Laurence Wingo
  • 3,912
  • 7
  • 33
  • 61
  • 1
    Only because it returns `UITableViewCell` – adnbsr Jan 20 '17 at 01:03
  • @abndsr Thank you. Would it be safe to assume that this is how majority of Apple's API's work in order to customize apps? The general idea being to subclass objects, customize them to our liking, and then plug them into the necessary places for them to be called? – Laurence Wingo Jan 20 '17 at 01:22

0 Answers0