SwuiPWER visually explained
In the article
VIPER with SwiftUI: SwuiPWER, A New Architecture Evolved from VIPER: VIPER with SwiftUI? Hell yes!
I explained what SwuiPWER is.
This time I’m visualizing SwuiPWER architecture structure in several aspects. It is much easier to view the visualized chart to understand SwuiPWER.
Simple possession chart
The simplest version of all. This explains what layers SwuiPWER has and who owns who. This chart doesn’t say much but it’s a good start point to understand SwuiPWER.
As you can see, SwiftUI View is a root of ever components.
Clean Architecture layers added
Now I added which SwuiPWER components correspond¥ to which layer of circle in Clean Architecture’s circle (please note that the circle of the clean architecture itself does not define Clean Architecture but rather just a suggestion of which layers to have when implementing Clean Architecture, Clean Architecture is all about dependencies more specifically DIP. See more info on my other articles explaining Clean Architecture).
This time, arrows represent direction of dependencies, not who possesses who. Important change here is that Wireframe is now the root of everything not View. In Clean Architecture everything in the outer circle must depend on inner circle and see how this is represented in the chart.
Adding protocols
Texts without square frame inside the chart are protocols.
Protocols defined in the charts:
- View Destination Creatable
- View Event Handling
- View Model
- Interactor Input
- Interactor Output
To achieve outer circle components to depend on inner circle components, every possession from inner circle component to outer circle component must be done using protocols defined in the inner circle. Also some protocols are used to separate direct concrete possession of a component to other and this is done to increase testability of the components.
Wrap up
Please also see VIPER with SwiftUI: SwuiPWER, A New Architecture Evolved from VIPER: VIPER with SwiftUI? Hell yes! for more understanding of SwuiPWER architecture.
If you want to translate this article into another language, see my profile for the guideline(it basically says yes but please check it before you do).
If you liked this article please hit the like button and subscribe button to not to miss articles like this.
If you liked this article please hit the like button and subscribe button to not to miss articles like this.