SwuiPWER visually explained

SwuiPWER: New architecture achieving VIPER with SwiftUI

Martin M
3 min readSep 5, 2024
SwuiPWER architecture possession chart

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

SwuiPWER architecture 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

SwuiPWER architecture chart with 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.

--

--

Martin M

A professional iOS developer with more than 10 years of experience.