Firestarter : an event-driven architectural framework for clean, predictable, testable Swift apps

Hello Swift devs! This week I've open-sourced Firestarter, a framework designed to overcome the challenges one has when building large scale apps with SwiftUI (but it could also work great in other contexts, like CLI apps or even server apps).

The main idea behind it is that views should never update the state directly, but fire events (called Actions in Firestarter) that get processed by consumers (called Workers in Firestarter), which are responsible for business logic and updating the state.

The approach is certainly not new, it's similar to Redux, Flux or even conceptually with microservices. However, it does work really well with SwiftUI: by fully decoupling views from the models it makes apps easy to debug, test, and develop.

Also, there are other goodies included, like middlewares, action history, the possibility to redirect/block/postpone an action and action flows.

I'm at the second app developed while using it, so, I'm also on the lookout for other features that might prove useful. Have a look, any feedback highly appreciated!

3 Likes

This looks pretty neat! I’ll definitely have a closer look at it later to see if it’ll work in my project (which has started getting pretty messy). Thanks for sharing :)

Hope it helps! And yeah, I know how it is: although SwiftUI is amazing I'll never understand why Apple decided to amass everything in the view, works well on toy/smaller projects, but once things get more complicated, tis hard to keep up with all the observable objects and @States while sync'ing the data between them.

I just always end up kind of making my own sort of mini framework as the project gets bigger.

Very cool. I love how many Flux-style libraries are emerging for Swift! There’s definitely a lot of ways you can slice the architecture with Swift’s type system and every project I’ve seen so far brings a slightly different set of benefits.