Comments (9)
Other ViewModel responsibilities not clear for me. Who manages
UINavigationController
stack?
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.
This system will allow to test and isolate application not just by parts, but also by task, user stories, and other logical chunks.
I'm not really familiar enough with DCI to comment on this.
- Common Shared state between ViewModels (network clients, core data contexts)
- Container View Controllers responsibility.
What exactly are your questions here?
from reactiveviewmodel.
In response to changes in the view model, the view layer will present or pop view controllers.
For example. In app we have 2 screens. List of some items, and item details.
User select some row.
- Table transfer control to its delegate, (typically controller)
- Controller change some property of ViewModel (
selectedItem
for example) (is it correct?) - View Model react and .. what? Change another property? Fire some event to the signal?
- Some how control flow goes back to controller - now controller need to instantiate next controller, push it to navigation.. But for this action controller need to create another controller's ViewModel, and some how link them with actual model. All this stuff is out of view competence, so i am sure there is error in my thoughts.
1.Common Shared state between ViewModels (network clients, core data contexts)
How common dependency traverse between view models? From one to another? then how transitive dependency solved? I mean:
A -> B -> C, where {A require D1, B require D2, C require D1}
from reactiveviewmodel.
- Controller change some property of ViewModel ( selectedItem for example) (is it correct?)
Yep.
- View Model react and .. what? Change another property? Fire some event to the signal?
Yes, exactly.
For example, the current view model may have a detailViewModel
property. Changing that property will notify the VC that a new view controller should be pushed onto the navigation stack.
How common dependency traverse between view models? From one to another? then how transitive dependency solved?
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.
from reactiveviewmodel.
Great Thanks for your time and explanations!
Now it is much more clear to me.
from reactiveviewmodel.
No problem!
from reactiveviewmodel.
How might one use ReactiveCocoa to pass data between ViewControllers?
I know that the typical way people do this is
- pass data forward by
- init-injecting data into next VC
- setter-injecting data into the
destinationViewController
inprepareForSegue:
when using storyboards
- pass data backward by having the previous view controller implement a delegate
Can ReactiveCocoa be used to streamline the way data is passed to and from view controllers?
from reactiveviewmodel.
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.
from reactiveviewmodel.
I'm also interested in passing data between ViewControllers with ReactiveCocoa. Could you share som example code? Let's say we have a UITableViewController
and a DetailViewController. If I tap a cell in the UITableViewController
how can pass along data based on the tap to the DetailViewController?
from reactiveviewmodel.
@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.
from reactiveviewmodel.
Related Issues (20)
- didBecomeInactiveSignal should skip:1 HOT 2
- What about ViewModel based routing? HOT 1
- didBecomeInactiveSignal send value before viewDidLoad,is this right? HOT 1
- Feedback on MVVM-ification of an app HOT 3
- Why forwardSignalWhileActive:(RACSignal *)signal subscribes only on the next and error, but not completed? HOT 3
- Add Carthage compatibility badge to the README
- How to build it and use it? HOT 6
- forwardSignalWhileActive as signal operator HOT 1
- retain cycle when using didBecomeActiveSignal HOT 5
- Error Handling in ViewModel HOT 2
- code inside [self.didBecomeActiveSignal subscribeNext:^(id x) {}] not called. HOT 2
- I'd like to know how to setup a ReactiveViewModel with multiple Models? HOT 1
- Using forwardSignalWhileActive to fix KVO performance on iOS 9.
- run error HOT 1
- Old version in cocoapods HOT 5
- 你好 更新框架文件为啥老是报错了? HOT 3
- GitHub API request failed: NetworkError(Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
- new plan to use Swift rewrite this demo HOT 1
- can`t pod install 0.3.3
- compile errors using @keypath syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactiveviewmodel.