-
Notifications
You must be signed in to change notification settings - Fork 269
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
Triggering Action #41
Comments
you need to subscribe to it so it is not disposed/deallocated right away. |
@zdenektopic you mean it needs to subscribe to Action? |
|
@devxoul Thank you. ScenarioI used ReactorKit and realized that my actions really work when I subscribe to the State. self.button.rx.tap
.flatMap { self.textField.rx.text }
.map { Reactor.Action.appendElement($0) }
.bind(to: reactor.action)
.disposed(by: disposeBag) where enum Action {
case appendElement(String)
} and in reactor.state.map { $0.element }
.subscribe { print($0) }
.disposed(by: disposeBag) After all of that, I can see how break points stop in QuestionHow can I bind my UI components to |
Ah, I got it. You may want to create a state stream without binding it to the view. Try this: class MyReactor {
init(params: MyParameters) {
self.initialState = State(foo: bar)
_ = self.state // add this line to create a state immediately
}
} |
Is there any chance to trigger the Action without subscribing to State?
For Example:
I have Action
saveKey(Key)
and I want to trigger action case without returning any
Mutation
case.Should I return
.empty()
observable? But it doesn't workThe text was updated successfully, but these errors were encountered: