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

Use StateRelay instead of Variable #82

Merged
merged 4 commits into from Oct 23, 2018

Conversation

Projects
None yet
3 participants
@tokijh
Contributor

tokijh commented Oct 4, 2018

How about create StateRelay like BehaviorRelay?
If you want to use BehaviorRelay without RxCocoa, let me suggest you a create new ObservableType.

StateRelay consist of BehaviorRelay and Variable just :)

@codecov-io

This comment has been minimized.

codecov-io commented Oct 4, 2018

Codecov Report

Merging #82 into master will decrease coverage by 0.96%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #82      +/-   ##
==========================================
- Coverage      93%   92.03%   -0.97%     
==========================================
  Files           6        7       +1     
  Lines         100      113      +13     
==========================================
+ Hits           93      104      +11     
- Misses          7        9       +2
Impacted Files Coverage Δ
Sources/ReactorKit/Stub.swift 100% <100%> (ø) ⬆️
Sources/ReactorKit/StateRelay.swift 84.61% <84.61%> (ø)
Sources/ReactorKit/Reactor.swift 82.5% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e71698...3e2717a. Read the comment docs.

README.md Outdated
@@ -211,13 +211,13 @@ func transform(action: Observable<Action>) -> Observable<Action> {
### Global States
Unlike Redux, ReactorKit doesn't define a global app state. It means that you can use anything to manage a global state. You can use a `Variable`, a `PublishSubject` or even a reactor. ReactorKit doesn't force to have a global state so you can use ReactorKit in a specific feature in your application.
Unlike Redux, ReactorKit doesn't define a global app state. It means that you can use anything to manage a global state. You can use a `StateRelay`, a `PublishSubject` or even a reactor. ReactorKit doesn't force to have a global state so you can use ReactorKit in a specific feature in your application.

This comment has been minimized.

@devxoul

devxoul Oct 17, 2018

Member

In this documentation I think Variable should be replaced with BehaviorSubject or something else. Because StateRelay is not tend to be exposed to public usage 😛

@@ -273,7 +273,7 @@ A view can be tested with a *stub* reactor. A reactor has a property `stub` whic
```swift
var isEnabled: Bool { get set }
var state: Variable<Reactor.State> { get }
var state: StateRelay<Reactor.State> { get }

This comment has been minimized.

@devxoul

devxoul Oct 17, 2018

Member

This line is the only one that StateRelay can be documented.

/// StateRelay is a wrapper for `BehaviorSubject`.
///
/// Unlike `BehaviorSubject` it can't terminate with error or completed.
public final class StateRelay<Element>: ObservableType {

This comment has been minimized.

@devxoul

devxoul Oct 17, 2018

Member

Could you please add some unit tests on this class?

@tokijh

This comment has been minimized.

Contributor

tokijh commented Oct 21, 2018

@devxoul I fixed it!

@devxoul devxoul merged commit 69072ce into ReactorKit:master Oct 23, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@devxoul

This comment has been minimized.

Member

devxoul commented Oct 23, 2018

Great job! Thanks for your contribution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment