| Twitter for iOSには選択中のタブをもう1度タップしたら最上部までスクロールするという機能があります。便利ですね。 Rxで1つ前の値を取得する - blog.ishkawa.org |
let tappedIndex = ReplaySubject<Int>.create(bufferSize: 1) そして、前回値と比較してイベントを発火するのはこんな感じで書きました。 var differenceObservable: Observable<Bool> {
return Observable
.zip(tappedIndex, tappedIndex.skip(1)) { previous, current in
return previous != current
}.filter { $0 }
.asObservable()
} あとはdifferenceObservableに対してsubscribeしておけば違う値が来たときにだけイベントが発火する仕様の完成です。 differenceObservable
.subscribe(onNext: { _ in print('do something') })
.disposed(by: disposeBag) この方法のミソはReplaySubjectは流れるイベントをbuffer分おぼえていて、skipを使えば指定したところのイベントがとれるので直前に流れたイベントを取得することができるって感じです。 こんにちは。virapture…
View Comments
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://www.binance.com/pt-BR/register?ref=B4EPR6J0
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://www.binance.com/hu/register?ref=IQY5TET4
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://www.binance.com/fr-AF/register?ref=JHQQKNKN
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://accounts.binance.info/ph/register?ref=IU36GZC4
Really impressed with the transparency and the odds. I will be spending most of my free time on idrusia777 from now on.
Found this site through a friend and it is actually legit. The game variety is impressive and it runs great on my mobile. Give phpunph a try today.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?