在VIPER体系结构中,每个演示者只与一个Interactor交互?(in VIPER architecture should each presenter interact with only on

编程入门 行业动态 更新时间:2024-10-25 08:18:29
在VIPER体系结构中,每个演示者只与一个Interactor交互?(in VIPER architecture should each presenter interact with only one Interactor?)

我在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.

更多推荐

本文发布于:2023-07-27 15:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292401.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:体系结构   演示   VIPER   Interactor   interact

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!