Data Context Interaction pattern on top of MVVM. #5
Comments
In response to changes in the view model, the view layer will present or pop view controllers. As a general rule of thumb, the view model should not use anything from UIKit. This isn't always possible, but it's a good guideline.
I'm not really familiar enough with DCI to comment on this.
What exactly are your questions here? |
For example. In app we have 2 screens. List of some items, and item details.
How common dependency traverse between view models? From one to another? then how transitive dependency solved? I mean:
|
Yep.
Yes, exactly. For example, the current view model may have a
This isn't a problem unique to VMs. Like you would do anywhere else, you can use dependency injection, or just pass to B the data that C will eventually need. |
Great Thanks for your time and explanations! |
No problem! |
How might one use ReactiveCocoa to pass data between ViewControllers? I know that the typical way people do this is
Can ReactiveCocoa be used to streamline the way data is passed to and from view controllers? |
Instead of having controllers communicate back via a delegate, declare a signal (or property) on the controller and have the invoking controller subscribe to that signal/property. |
I'm also interested in passing data between ViewControllers with ReactiveCocoa. Could you share som example code? Let's say we have a |
@bangerang You can create the next view controller by passing a view model to its initializer, or just set a property, like in @ashfurrow's C-41 project. |
Hi, this rather a question or ask for advice, but definitely not an issue.
I spend some time today playing with architecture described in README.md
So at first some of my assumptions.
UINavigationController
stack?If all above assumptions are correct, then ViewModel can act as a Role in DCI pattern.
In this pattern Roles collected in Contexts, or in another words - Use cases.
Each Use case can also have some output signals or commands which will trigger start of another use cases.
And finally, Use cases can be connected with each other in some Workflow or Application entity.
This system will allow to test and isolate application not just by parts, but also by task, user stories, and other logical chunks.
Open questions.
The text was updated successfully, but these errors were encountered: