2

Here is the project folder hierarchy. I would like to know what design pattern is used in this case. So far I have found out is that it is most likely to be Clean-Swift Architecture (VIP).

UnknownPattern

Below is the folder hierarchy of a sample Clean-Swift Project.

Clean-Swift

2 Answers2

5

Based on the file names this architecture consists of View, Presenter, and Router - so it's more likely MVP. In Clean Swift architecture should be an Interactor.

Andrey Volobuev
  • 862
  • 8
  • 11
  • Could you explain a bit more about the role of an Interactor in Clean Swift? Thanks. – Saw Thinkar Nay Htoo Mar 14 '18 at 02:40
  • 1
    Sure, interactor handles use cases and business logic. So it holds and calls services which return entities. Services make network calls, database queries etc. Then interactor applies business rules to these entities. After that presenter converts these entries to the simple structs for a view to display. Presenter and view shouldn't know about the entities so interactor passes entries using static polymorphism (protocols), for example like this `func didLoaded(_ viewModelConvertibles: [ViewModelConvertible])` – Andrey Volobuev Mar 14 '18 at 09:32
3

You need to divide Business and Presentation layers. Business: Models (Plain, Entity), Services: (all services must be wrapped in protocols). Presentation layer: all scenes (modules). Inside each scene 5 folders: view, router, interactor, presenter, assembly. But it just a one implementation. Choose the best and enjoy : ]