From the course: iOS Lean Controllers: 2 Controls, Views, Extensions, and Networking

Unlock this course with a free trial

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

Creating a generic data provider

Creating a generic data provider

- [Instructor] Alright, welcome back. Let's take our first step in implementing a generic data provider. So I'm gonna go ahead and add a New File. And it will be just a Swift File. We'll call this file FetchedResultsProvider. And the main reason for fetched results, or the main duty of FetchedResultsProvider, will be to fetch the data using the NSFetchedResultsController from the SQLite database, basically using core data. Alright? But of course the FetchedResultsProvider will be our generic provider. So it doesn't matter if you're fetching a shopping list. It doesn't matter if you are fetching a grocery item. It's a generic provider. So here we go. Class FetchResultsProvider. Now so it should inherit from something. Or maybe it doesn't have to inherit from something at this particular point, right? So we have created a class called FetchedResultsProvider. And the first thing we need, we definitely need the NSManagedObjectContext. So for that I'm just gonna use a CoreData reference…

Contents