2

This is a kind of question regarding best practice.

I am using VIPER architecture in my iOS project. I use haptic feedback for some use cases. Where would be the best place to invoke UINotificationFeedbackGenerator in VIPER? I believe it is View.

iOS
  • 3,526
  • 3
  • 37
  • 82
  • 1
    From my experience with VIPER, I would say that everybody would put it somewhere else. I can imagine someone creating a feedback service that is called from interactor. There are good arguments for putting it to presenter. VIPER is an overcomplicated achitecture and the fact that programmers don't know where to put things, is one of the reasons why VIPER is not exactly the best possible way to architecture apps. – Sulthan Feb 13 '22 at 14:43
  • 1
    The real trouble is that any answer is debatable. The OP is just looking for opinions — and that's forbidden on Stack Overflow. Personally I would say that _knowing_ we need feedback is Presenter material, _causing_ the feedback to happen is View material, and _implementing_ the feedback is a Service. – matt Feb 13 '22 at 15:57

1 Answers1

3

You should place it in presenter , why ?

View => It's not a view

Interactor => It doesn't involve intercalation with data

Entity => It's not a model

Router => It's not used to navigate to other pages

you can learn more about that architecture Here

Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87