Created
November 3, 2018 08:49
-
-
Save creaaa/39abff9d17c5de67987b358f11dce3ea to your computer and use it in GitHub Desktop.
bossの中のmap(Cold)は、3箇所から購読されてるので3回読まれているが、subscribe onNextの中("hogehoge1"とか)は、それぞれ1回しか実行されないぞ。当たり前かもだが。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let boss = self.tfBoss.rx.text | |
.map { text -> String in | |
print("はいきた") | |
let t = text ?? "" | |
return t | |
} | |
boss.subscribe(onNext: { text in | |
print("hogehoge1") | |
self.tf1.text = text | |
}) | |
boss.subscribe(onNext: { text in | |
print("hogehoge2") | |
self.tf2.text = text | |
}) | |
boss.subscribe(onNext: { text in | |
print("hogehoge3") | |
self.tf3.text = text | |
}) | |
// 結果 | |
はいきた | |
hogehoge1 | |
はいきた | |
hogehoge2 | |
はいきた | |
hogehoge3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment