Thanks for the tutorial it is interesting I was eager to see the result, I was wondering how to make a VIPER stack in SwiftUI.
There is 2 thing2 that bothers me a lot in the placement of some code that (for me) goes against the VIPER principle.
When I do a presenter in VIPER with UIKit, I will not import UIKit in the presenter, just in the View and in the router if there is no global app routing in place.
So when I see SwiftUI being imported in the presenter and the presenter creating and returning views to the view layer, it feels like those method are stealing responsibility from the view. Which breaks the separation between View and Presentation layer.
The second point is similar, when I see code in the presenter creating NavigationLink it feels like the presenter is stealing some of the Routing layer responsibility. Why do the presenter knows that its a navigation link at all.
I know that navigation is weird (at best) in SwiftUI (especially NavigationLink that create the next view right away, instead of passing a factory closure…), but I would at least make the Router create the whole thing and just have the presenter forward the router’s creation instead of having the presenter do some of that routing.
Once again, thanks for the tutorial it was interesting to read the code. It brought me more knowledge about SwiftUI.
P-S: It would be nice / instructive to have some unit test in the final project files to showcase the testable advantage of the architecture.