Rethink the architecture
Current design is as follows
You navigate to a Loader, which renders a View inside it. Problem is: some of the UI is already implemented there.
Current loader design
- Loads an entity through the
API
class - Implements the
List
and with it.refreshable
.onAppear
.toolbar
- Shows loading / error states
Current view design
- Gets an entity
- Displays it and
- more loaders (e. g.
ProjectLanguagesLoader
)
- more loaders (e. g.
- Adds more functionality
.swipeActions
- e. g. starring a project
- sometimes
.refreshable
Brief look into the past/future
This App and its architecture already have come a long way. I miss MVC design pattern, where you had a clear boundary between them. I think that maybe I should start writing up Models and working with a few global things, instead of these loaders. The thing I always have in my Loaders is the variable loadFailed
, which when the load fails shows an Error message, which is everywhere the same. Maybe this could be implemented in the Top-Most View as a global thing, which would just be set during the load. Also which a good structure it should be easier with models to work with things like paging, which have to be implemented globally.
New loader design
There won't be loaders.
New view design
Everything is happening in the view, but with Models instead.
- Loads entity through some
Model
class - Implements the
List
and with it.refreshable
.onAppear
.toolbar
- Implements more functionality like
- e. g. starring a project
.swipeActions
- Displays the entity
- and other Views
- but using more components instead of one long view - file
- Shows loading states
- error states are managed through a global error dialog
I am not sure whether this is a step back or forwards!