Skip to content

Introduce MVVM #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: unstable
Choose a base branch
from

Conversation

ivinjabraham
Copy link
Contributor

@ivinjabraham ivinjabraham commented Jun 27, 2025

This PR address #139. I cannot foresee all the necessary steps at the moment but I will change this body when I can see the plan taking a more concrete form. Ideally, I will be able to integrate it without causing regressions i.e have the new architecture work alongside the old. But it is unclear how to go about that at the moment.

My local version of clippy (v0.1.88) seems to have added a new check and is now throwing errors for string interpolation syntax across the codebase. I haven't fixed them in this PR since it seems logically out of place. Though I think someone should raise an issue if they can confirm that it's not just on my machine.

The `App` struct serves as the model in the MVC pattern. The proposed
MVVM refactor will continue using it as the primary Model. Rename `App`
to `Model` to better reflect it's purpose.

Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
@ivinjabraham ivinjabraham changed the base branch from master to unstable June 27, 2025 13:30
The `View` is a crucial part of MVVM that will handle the UI. Rename the
struct from `CurrentScreen`, which conveys logic, to simply `View` that
will reflect it's purpose in the architecture.

Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
@ivinjabraham ivinjabraham force-pushed the refactor/introduce-mvvm branch from 60a720b to 491da19 Compare June 28, 2025 20:22
The MVVM refactor will require a trait for viewmodels to establish a
reliable interface. Introduce a basic implementation of the trait with
no usage.

Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
@ivinjabraham ivinjabraham force-pushed the refactor/introduce-mvvm branch from f0fc8a9 to d24496f Compare June 29, 2025 04:18
To use as a key in a hashmap, a type must implement `Eq` and `Hash`.
Additionally, `Copy` is required as well to be used in the .entry()
method of Hashmap.

Derive `Eq`, `Copy` and `Hash` on View to use it as a key in Hashmaps.

Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
@ivinjabraham ivinjabraham force-pushed the refactor/introduce-mvvm branch from d24496f to 4b10584 Compare July 2, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant