Questions tagged [viper-architecture]

VIPER is an application of Clean Architecture to iOS apps.

127 questions
3
votes
1 answer

Where is the better place for a function used on a lot of controllers using VIPER?

I'm using VIPER pattern within my Swift app. I need a function that is executed in a lot of controllers to open a cardViewStyle. I don't know where is the better place to add this function... Could be a useCase? An Interactor?, common... I haven't…
user3745888
  • 6,143
  • 15
  • 48
  • 97
3
votes
2 answers

Creating a new VIPER module from Wireframe using SwiftUI

I am trying to implement VIPER using SwiftUI. Firstly, I was returning a UIKit VC(UIHostingController(rootView)) from the Wireframe until I realized that in navigation, when presenter tells Wireframe to present a SwiftUI View, I can not pass a…
Andoni Da Silva
  • 1,161
  • 15
  • 31
3
votes
2 answers

iOS VIPER interactor best practice

In an iOS VIPER project, there is a need to call a remote service (e.g. refresh token + check user login ) in every module. What is the best practice of implementing this need? Can we have multiple interactors per module? Or Should we implement the…
riza milani
  • 163
  • 1
  • 7
3
votes
3 answers

How to reflect the new section to UICollectionView in RxDataSource?

I am building an iOS app with RxSwift and RxDataSource using VIPER architecture. I want to change the content of the UICollectionView as the value of the presenter changes (as the user typed in some letters in the searchBar, the collectionView…
3
votes
1 answer

EXC_CRASH (SIGABRT) UIPopoverPresentationController presentationTransitionWillBegin

I have received crash log from production and cannot understand how to reproduce it. It happened only once on iPad with iOS 9.3 as per information I have. This crash happened after my latest release where I used VIPER methodology for some of my…
DJ-Glock
  • 1,277
  • 2
  • 12
  • 39
3
votes
3 answers

Where have timer be in Viper architecture

Let's suppose that every 10 seconds we have to update our data. Where should we create/store timer and where will it fire associated method in VIPER architecture? Should ViewController do that and inform presenter? or Presenter should hold the…
3
votes
1 answer

iOS VIPER - Should a custom alert (similar to UIAlertView) be a different module?

I have a module, e.g module A, and after doing some work and clicking on a button of viewControllerA, I should receive a custom "alert" that the request I tried was successful. The "alert" should have a close button, to let the user close the view…
rgoncalv
  • 5,825
  • 6
  • 34
  • 61
3
votes
2 answers

Unit Testing an Object and a Variable that conforms to a protocol in Swift

I have a VIPER architecture setup and am trying to unit test the instantiation of the wireframe. For anyone who doesn't know what VIPER is, the key parts to understand are that there is are 4 classes that that have key responsibilities. The…
ColdLogic
  • 7,206
  • 1
  • 28
  • 46
2
votes
0 answers

How to initialize view controller of a container view with viper design pattern in swift?

I want to initialize a view controller of a container view with VIPER design pattern and I tried to use addChild() function but it didn't work so anyone can help? let homeVC = Storyboard.Main.viewController(HomeViewController.self) let…
2
votes
1 answer

Pass data between VIPER modules

I'm building my first app using VIPER. I have two modules: ObserverModule and CurrenciesModule. I modally present CurrenciesViewController from ObserverViewController, and when CurrenciesViewController is being dismissed, I need…
MaryLitv21
  • 379
  • 1
  • 12
2
votes
1 answer

Multiple View Controllers in a single VIPER module

I'm building my first app using VIPER architecture. I have two VCs: the main one and the modal one (presented modally from the main VC). There is a tableView inside my modal VC, and when the user selects a row there, I need to pass it to presenter…
MaryLitv21
  • 379
  • 1
  • 12
2
votes
1 answer

Custom Table View outlets throwing nil

I am trying to implement a simple iOS app using the VIPER pattern following this tutorial. The app is a simple table view which displays data from a json req I have created the table view and can successfully show data from my object using the…
Nouman
  • 585
  • 1
  • 11
  • 24
2
votes
1 answer

Using Swift Generics in Base class to easily return type class to subclass

I want to hold onto a Interactor class in a BasePresenter class, but for the life of me I can't figure out how on earth to use generics easily in Swift. I want to have a function in the base class (like BasePresenter interactorForType). public class…
Nick N
  • 984
  • 9
  • 22
2
votes
2 answers

Modules as independent frameworks in an Xcode project

Let's say there is an Xcode project with 50 Swift modules. A module is a VIPER module composed by 7 files: ViewController Presenter Interactor NetworkManager Router Entities There are more than 50*7 = 350 files to compile and I really want to…
pascalbros
  • 16,122
  • 5
  • 23
  • 35
2
votes
0 answers

VIPER/CleanSwift. Where to put reusable business-logic that is used across many views?

I want to start using CleanSwift architecture, especially the VIPER interpretation thereof, but I have some question. Example: I have cart view. When some new item added to cart, that view update data (count increase). And when I press on it - open…
1 2
3
8 9