Read this in other languages: 简体中文
EasyReact is an easy-to-use reactive programming framework.
Are you confused by the functors, applicatives, and monads in RxSwift and ReactiveCocoa? It doesn't matter, the concepts are so complicated that not many developers actually use them in normal projects. Is there an easy-to-use way to use reactive programming? EasyReact is born for this reason.
Note: The "Node" listed below refer to EZRNode
, a unified representation of various values (all object types) in EasyReact.
- Create node or mutable node
- Get the value of the node immediately
- Listen to the future value of the node
- Cancel listening to a node
- Connect two points
- Basic transformation of a node
- Combine multiple nodes
- Branch a node to get multiple nodes
- Synchronize values across multiple nodes
- High-order transformation of nodes
- Traversing nodes and edges
Compare other Functional Reactive libraries (e.g. ReactiveCocoa or ReactiveX)
Project | EasyReact | ReactiveCocoa | ReactiveX |
---|---|---|---|
Core idea | Graph theory and object-oriented programming | Functional programming | Functional programming and generic programming |
Propagation variability | ✅ | ❌ | ❌ |
Basic transformation | ✅ | ✅ | ✅ |
Combination transformation | ✅ | ✅ | ✅ |
High-order transformation | ✅ | ✅ | ✅ |
Traversal node/signal | ✅ | ❌ | ❌ |
Multi-language support | Objective-C (Other language versions will open source in the future) |
Objective-C, Swift | Many language versions |
Performance | faster | slow | fastest |
Chinese document support | ✅ | ❌ | ❌ |
Debugging tools | Topology display More rich dynamic debugging tools(Coming soon) |
Instrument | ❌ |
- iOS 8.0 +
- Xcode 8.0 +
git clone
this repo,excute pod install
in Example/, then open EasyReact.xcworkspace
.
Add the following content in Podfile
pod 'EasyReact'
Then execute pod install
EasyReact contains a complete unit test with the relevant code in the Example/Tests folder. You can open the sample project and execute the Test command to run these unit tests.
Mac OS 10.12.6, CPU: 2.9GHz, Core i5 Xcode 9, iOS11, iPhone 8 Plus simulator
- Single stage operations, such as listener, map, filter, flattenMap, etc.
- Multicast operations, such as combine, zip, merge, etc.
- syncWith operations
The scale of the test is based on 10 operating objects and 1000 triggers. For example, the listener method has 10 listeners and repeats the action of sending the value 1000 times. The unit of time is ns.
Repeat the above experiment 10 times to get the data as follows:
name | listener | map | filter | flattenMap | combine | zip | merge | syncWith |
---|---|---|---|---|---|---|---|---|
EZRNode | 4775053 | 57487844 | 13851412 | 11966681 | 18972713 | 134567221 | 36076535 | 18388601 |
ReactiveCocoa | 6273485 | 102644235 | 66771529 | 80881225 | 496207382 | 327464977 | 29010632 | 100022454 |
RAC:EZRNode | 131.38% | 178.55% | 482.06% | 675.89% | 2615.37% | 243.35% | 80.41% | 543.94% |
ReactiveCocoa's average time consuming is 618.87% times more than EasyReact.
EasyReact will compare benchmark with RxSwift when the Swift version open source recently.
William Zang, chengwei.zang.1985@gmail.com
姜沂, nero_jy@qq.com
Qin Hong, qinhong@face2d.com
SketchK, zhangsiqi1988@gmail.com
zesming, ming9010@gmail.com
Zhiyu Wong, www312422@vip.qq.com
johnnywjy, johnny.wjy07@gmail.com
qiezishu, qiezishu@yahoo.com
EasyReact is Apache Public License 2.0