我在http://www.objc.io/issue-13/viper.html (以及其他一些资料)阅读了关于VIPER体系结构的内容,但我仍然无法弄清楚一件事情,每个演示者最多是否应该与之互动一个Interactor?
以下是关于它的更长时间的讨论,可以更好地解释我的问题: 使用两种方式进行相同操作的用例
I read about VIPER architecture here http://www.objc.io/issue-13/viper.html (and in a few other sources), but I still can't figure out one thing, should each presenter interacts with at most one Interactor?
Here is a longer discussion about it that might better explain my question: Use Case with 2 ways for the same action
最满意答案
就我所知,主持人每个VC都是独一无二的。 但是,当演示者需要多个交互者时,他可以使用它们。
我认为交互器是一层商业逻辑,他们可以互相交流,并且演示者可以与其中的很多人进行交互。
但是,将正确的逻辑放在正确的层中很重要。 例如,注意不要将业务逻辑放在演示者层中,因为它非常适合在几个相互作用器之间导航的时候。 请记住只将商业逻辑放在交互器中。
As I get it, the presenter is unique per VC. However, when a presenter needs several interactors, he may use them.
The interactors as for my opinion is a layer of business logic, they can interact with each other and the presenters can interact with many of them.
However, it's important to put the right logic in the right layer. For instance, be careful not to put the business logic in the presenter layer since its very tempting to while having to navigate between several interactors. Keep in mind to put the business logic only in the interactors.
更多推荐
发布评论