-
Notifications
You must be signed in to change notification settings - Fork 2
Swift UI mvi enhancements #47
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
base: swift_ui_mvi
Are you sure you want to change the base?
Conversation
1. Separation of concerns: ViewModel has more responsibility then storing the view state I can imagine that in the future we want to have some kind of middleware before the intent handler (for the observability events for example) for that we need a separate view model and it needs to be open for inheritance).
|
Im not sure i follow, do you mean in the case that a customer copies the code for the journey view and wants to add their own state? i guess so, but i guess it depends, as an implementer do i want my custom state to be the first class state, or the journey state?
yeah this is just wishful thinking if we can use iOS 17. im just wondering also with the enum state way, even though it may guide you into not making invalid states, it also can limit the person customising the journey. what may be an invalid in a OOTB journey, may not be after adding some custom state on top of it, which would make you have to ditch all the screens built in stuff probably. but maybe that is an unlikely scenario. Im also wondering that some customers may want to combine viewmodels potentially, and then 2 viewmodels may want to interact in the same screen, the enum scenario might make this difficult to do as the valid states would be totally different. it does require the implementer to have a deeper understanding of whats going on though, but they would have more freedom to do the changes they need.
for 1, the previous viewmodel implementation wasnt even a viewmodel really, it didnt do much besides forwarding intents to the intent handler and had a property for state. so for sepration of concerns i felt like the viewmodel had no concerns to begin with really. |
Main changes:
State
is now @observable for better performance, each property publishes individually instead of the entire state