Skip to content
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

Inroduce IdentityEquatable and IdentityHashable #136

merged 2 commits into from Nov 19, 2019


Copy link

devxoul commented Nov 19, 2019


#124 contains a potential issue when binding reactors with state comparison. For example:

// view.reactor
//   - address: 0xaaa
//   - state: {count: 2}
// newReactor
//   - address: 0xbbb
//   - state: {count: 2}

if view.reactor != newReactor {
  view.reactor = newReactor // will not be executed


view.count // returns 2, but expected 3


This PR introduces IdentityEquatable and IdentityHashable. IdentityEquatable implements == that returns whether two reactors are identical. IdentityHashable implements hashValue that returns a unique hash value of its identity.


This comment has been minimized.

Copy link

codecov bot commented Nov 19, 2019

Codecov Report

Merging #136 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #136   +/-   ##
  Coverage   95.69%   95.69%           
  Files           9        9           
  Lines         209      209           
  Hits          200      200           
  Misses          9        9
Impacted Files Coverage Δ
Sources/ReactorKit/IdentityEquatable.swift 100% <100%> (ø)
Sources/ReactorKit/IdentityHashable.swift 100% <100%> (ø)

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 98964ae...30edd8d. Read the comment docs.

@devxoul devxoul merged commit 9c57545 into master Nov 19, 2019
3 checks passed
3 checks passed
test (iphonesimulator13.0, platform=iOS Simulator,name=iPhone 11 Pro,OS=13.0)
test (macosx10.15, arch=x86_64)
test (appletvsimulator13.0, OS=13.0,name=Apple TV)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.