Comments (8)
flattens是一种降阶的操作。比如信号A (a1, a2,a3..)在执行中,信号B执行了 b1,b2。
我们暂且当成两个线程理解,以时间为参考,假如结果是 a1 ,b1,a2,a3,b2 , flatten后的结果就是这么一条线。
from reactivecocoa_use.
switchToLatest是执行最新的信号,信号A中a1,a2执行,在a1结束后,信号b1在a2开始执行前执行,在b1执行期间a2执行,然后b1结束。switchToLatest操作后,结果就是a1, b1 ,把a2过滤了。
from reactivecocoa_use.
@huangxianhui001 二者虽然都是降阶操作,但是方式是不同的。flattens直接粗暴,一条线执行。switchToLatest内部还要考虑信号的开始和执行问题。
from reactivecocoa_use.
@WiKi123 可以考虑加个 demo 演示一下两者的区别
from reactivecocoa_use.
@huangxianhui001 你可以选中列表中那个方法,点击右上角图片按钮。那样看起来比较清晰。里面是图文解释的。
from reactivecocoa_use.
很不巧,RACCommand的几个例子都没有图片
from reactivecocoa_use.
最下面关于flattens和switchToLatest是有图片的。
from reactivecocoa_use.
赞,看到了
from reactivecocoa_use.
Related Issues (2)
- 下载的项目打不开 HOT 5
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 reactivecocoa_use.