Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which it is the place for NSFetchedResultsController in VIPER architecture?

In VIPER, unlike the MVC, the role and place not so clearly defined for NSFetchedResultsController.

Is it right to place it on the interactor?

like image 874
David Avatar asked Jul 19 '16 08:07

David


People also ask

What is Viper in Salesforce?

So, What is VIPER architecture? VIPER is a backronym for View, Interactor, Presenter, Entity, and Router. This architecture is based on Single Responsibility Principle which leads to a clean architecture. View: The responsibility of the view is to send the user actions to the presenter and shows whatever the presenter tells it.

What is Viper in iOS testing?

So VIPER is developed to increase the method to test the software in a better way in the application architecture. VIPER provides the defined architecture to iOS applications in all the mobile and software components. The VIPER is expanded as View, Interactor, Presenter, Entity, and Routing.

Where do Viper modules sit in the system?

All the VIPER modules are sitting inside the Modules folder. Everything that's network or data related goes to the Services folder (api service, core data service, location service, etc.) and later on gets used in the module builder depending the current environment (for example mock implementation for testing).

What is the Viper architecture pattern?

In this tutorial, you’ll learn about using the VIPER architecture pattern with SwiftUI and Combine, while building an iOS app that lets users create road trips. The VIPER architectural pattern is an alternative to MVC or MVVM.


2 Answers

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.

like image 125
Igor Azarov Avatar answered Oct 20 '22 06:10

Igor Azarov


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.

like image 44
Melinda Sámson Avatar answered Oct 20 '22 08:10

Melinda Sámson