Nothing here yet.
pair programming, kata sessions and live codings!
Hey, Pavel thanks for your question. And like all other architectural questions, it depends. For this case, if I understand right all the stated behavior is not connected to any business rules (or logic rules). It is a pure app's flow behavior. So, this way I would add this analytics step between who generates the tap ( for example the UIViewController) and who is responsible for the app's flow management ( for example a Coordinator, or a Router). Ex: On an N layer architecture as UI Generate tap (UIViewController) -> ViewModel/Presenter -> Coordinator(flow controller), your analytics should be between the ViewModel and the flow controller. Why? Because you are delegating all the responses from the UI to the ViewModel. Imagine that you want to change the exact same screen from storyboards to SwiftUI, you don't want the side effect of losing your analytics in the process. In the same way, if your architecture is: UI Generate tap -> Coordinator(flow controller), you should add the analytics between the UI and the Coordinator because like in the example above, even if you change the UI you still have the analytics working. The principle is to think about separating the maximum you can the concerns of your app. Don't let one functionality/behavior leak to other places. Have a nice weekend bro! And thanks for the reading!
Hey man, thanks for the comment. I updated the code with a more "protocol approach". And now we can use the protocol inside our ViewModels instead of the concrete implementation. If you don't mind, I also mentioned thanking you in the summary of the post. You are awesome and hope you have a great day bro! :)