Hey, for those familiar with coordinator pattern or Stinsen, I published new version of Scaffolding SPM, which eases up setting up complex flows and navigations within the app by modularizing the flow patterns, achievable in plain SwiftUI with lots of boilerplate that you don't need to write each time using this.
Alongside has been published new website which explains coordinator concepts in depth alongside a interactive simulator and flow graphs.
Build fully on SwiftUI, one macro and linked list allows to create flows outside of view-layer and State dependent with minimal boilerplate and already known API.
Be sure to check it out and leave comments! Any additions, improvements or critics are welcome
Example
@Scaffoldable
final class HomeCoordinator: @MainActor FlowCoordinatable {
var stack = FlowStack<HomeCoordinator>(root: .home)
func home() -> some View { HomeView() }
func detail(item: Item) -> some View { DetailView(item: item) }
func settings() -> any Coordinatable { SettingsCoordinator() }
}
...
// Instantiate the flow in the root of the app, nowhere else, that's the setup. The SPM handles everything
@State private var coordinator: HomeCoordinator = .init()
// in body
coordinator.view
coordinator.route(to: .detail(item: selectedItem)) // push
coordinator.present(.settings, as: .sheet) // sheet (sub-flow)
coordinator.pop()
https://dotaeva.github.io/scaffolding/
https://github.com/dotaeva/scaffolding