From the course: iOS Lean Controllers: 1 Setup, Persistent Data, and Implementation

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Implementing shopping list data sources

Implementing shopping list data sources

- [Instructor] All right, welcome back. In this lecture, we're going to focus on implementing the data source, which means that we will be removing the numberOfSections, the numberOfRowsInSection, and cellForRowAt indexPath, all these delegate methods into a separate class called shoppingListDataSource, which will be responsible for doing all of these things. But before I, of course, do that, I know that in the last lecture, we left at the sections, we were not able to return the sections. I have already updated our shoppingListDataProvider to have a sections property that will return you the number of sections. If you want to take a look at it, it's right over here. It simply pass the fetchedResultsController to return the sections, and that's pretty much what it does. Let's go ahead and add our data source method. Now, once again, why are we doing that? Why are we adding a shopping list data source like a separate file? The reason is that if we want to use or want to display the…

Contents