From the course: iOS App Development: Design Patterns for Mobile Architecture

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Entities

Entities

- [Instructor] We've moved all of our logic into the proper layers, but our app is still tightly coupled to the core data instance of a Spy object. We should be using Spy DTOs anywhere above the data layer. So the first step is to come into this SpyListPresenter and move these typealias blocks to where they belong and start changing things to return only a Spy DTO if it's not within the data layer. Let's cut this SpiesBlock and move this into the data layer. We expect this to be using just the normal Spy object. But this next block, Let's move this into the model layer. And this one should only be using a Spy DTO object. Just by doing this, it will force us to start changing the DTO object everywhere. So this load from DB method, we need to translate those spies coming from Core data and convert them to DTO objects. So we'll say, let dtos = translationLayer.toSpyDTOs, and we'll just hand it the spies. And instead of returning those spies, we're going to use those DTOs. We can build…

Contents