DEV Community

Discussion on: Getting Started with Diffable Data Source

Collapse
 
francisfeng profile image
Francis Feng • Edited

Hi there! Thanks for your great article. I've learned a lot.

But I'm a little confused about this note:

Note : If you want to use titleForHeaderInSection and titleForFooterInSection both part of UITableViewDataSource, you can simply create UITableViewDiffableDataSource subclass and override the methods of you want to implement.

Why do I need to subclass UITableViewDiffableDataSource to use titleForHeaderInSection and titleForFooterInSection while the other delegate methods just work in ContactsTableViewController?

Collapse
 
ahmed_komsan12 profile image
Ahmed Komsan

This is because titleForHeaderInSection and titleForFooterInSection are part of UITableViewDataSource and UITableViewDiffableDataSource conforms to UITableViewDataSource ... so to use both methods or any others datasource methods, you can simply create your UITableViewDiffableDataSource subclass and override the data source methods you want in your subclass.