In VIPER, unlike the MVC, the role and place not so clearly defined for NSFetchedResultsController.
Is it right to place it on the interactor?
In VIPER, unlike the MVC, the role and place not so clearly defined for NSFetchedResultsController.
Is it right to place it on the interactor?
According to this article interactor should not know how to persist the entities.
VIPER and the architecture that uses NSFetchResultController are different approaches. There is no right place for NSFetchResultController in VIPER.
VIPER is good for big application as it provides architecture layers that are isolated well.
NSFetchResultController is good for smaller application as it helps to develop faster.
NSFetchedResultsController is a Core Data specific way for observing database changes. It's a popular pattern to use and can be found in most mobile database systems.
It's possible to use this kind of observation underneath a database abstraction layer, so if we take a full VIPER architecture of a mobile application it can be implemented underneath the Interactor. According to the accepted answer it shouldn't be put into the Interactor, because the Interactor shouldn't know about the type of local database it's using. Though I can't come up with anything against using it at a database level.
© 2022 - 2024 — McMap. All rights reserved.