TableViewDatasourceProtocol is provided as soon as you add a table view to your screen. TableViewDatasourceProtocol includes 2 required functions and one optional.

Required functions:

  • tableView:cellForRow:andSection:  This function provides three function arguments. A tableView, a row, and a section.  In this function, you provide your table view with the cell to be placed in the specific row and section. After initializing the cell of your choice, you can set its values as you wish. When you have finished, return your customized cell!
  • tableView:numberOfRowsInSection: Should return the number of items you wish to be placed in the specific section of your collection view.

Optional functions:

  • numberOfSectionsIn: Should return the number of sections you want your table view to have.
Did this answer your question?