本文主要是介绍RxSwift操作符,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
RxSwift 和OC RAC完全不一样 ,但是和RxJava相似度90%
下面看个列子
传统实现方法:button.addTarget(self, action: #selector(buttonClick), for: .touchUpInside)
func buttonClick() {print("buttonClick")
}
通过 RxSwift 来实现:button.rx.tap.subscribe(onNext: {print("buttonClick")}).disposed(by: disposeBag)这个语句和RxJava相似度100%
RxSwift操作符:
amb
buffer
catchError
combineLatest
concat
concatMap
connect
create
debounce
debug
deferred
delay
delaySubscription
dematerialize
distinctUntilChanged
do
elementAt
empty
error
filter
flatMap
flatMapLatest
from
groupBy
ignoreElements
interval
just
map
merge
materialize
never
observeOn
publish
reduce
refCount
repeatElement
replay
retry
sample
scan
shareReplay
single
skip
skipUntil
skipWhile
startWith
subscribeOn
take
takeLast
takeUntil
takeWhile
timeout
timer
using
window
withLatestFrom
zip
这篇关于RxSwift操作符的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!