From the course: RxSwift: Design Patterns for iOS Developers

Unlock this course with a free trial

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

Core Data example code

Core Data example code

- [Instructor] So the first place for us to start is in the model layer. And in this model layer, we're going to put something knew on line 10. I'll just say let photo descriptions equals to a variable of type photo description entity. And we'll talk about the differences between those two types in a moment. We'll give this just a default array with no values in it, so whoever subscribes the first time they'll just get an empty array to deal with. I'll say mark database example extension model layer. Let's go ahead and give ourselves a lot of lines to work with here. And in here I'm going to just make a method load all photo descriptions. And persistence layer dot load all photo descriptions and that is going to take a block that has photo descriptions of its own. So, we'll call it that. And then these are actually core data objects that are going to be coming through, so we need to translate those to this entity type. So, first, let's say entities is equal to photo descriptions dot…

Contents