Publishers.ReplaceEmpty
์ ๋ค๋ฆญ ๊ตฌ์กฐ์ฒด | ๋น์ด ์๋ ์คํธ๋ฆผ์ ์ ๊ณต๋ ์์๋ก ๊ต์ฒดํ๋ Publisher
์ด๋์ ๋ผ์ด์ ๋ ๋ ๊ฐ์ ์ธ์๋ฅผ ๋ฐ๋๋ค.
upstream
: ์์์ ํ๋ฅด๋ Publisheroutput
: ์์์ ํ๋ฅด๋ Publisher๊ฐ ์ด๋ ํ ์์๋ ์ ๋ฌํ์ง ์๊ณ ์ข ๋ฃํ ๋ ์ ๋ฌํ ์์
์์ Publisher๊ฐ ์ฆ์ ์ข
๋ฃํ๋ Empty
์ ๊ฐ์ ๊ฒ์ด๋ ์ํ์ค๊ฐ ๋น์ด ์๋ Publishers.Sequence
๋ฑ์ธ ๊ฒฝ์ฐ์ ํด๋น Publisher์ ๋ช
์๋ ๊ฐ์ผ๋ก ๊ต์ฒดํ๋ค.
๊ฐ์ ๋ด์ง ์๊ณ ์ข ๋ฃํ๋ Publisher๊ฐ ํน์ ๊ฐ์ ๋ด๊ณ ์ข ๋ฃํ ์ ์๊ฒ ํ๊ธฐ ์ํด ์ฌ์ฉํ ์ ์๋ค.
replaceEmpty
์คํผ๋ ์ดํฐ์ ๊ด๋ จ์ด ์๋ค.
์์ ์ฝ๋ ๋ชจ๋ Publishers.Sequence
Publisher์ ๋น ๋ฐฐ์ด์ ๋ฃ์ด ๊ฐ์ ๋ด์ง ์๊ณ ์ข
๋ฃํ๋ Publisher๋ฅผ ๋ง๋ ๋ค.
replaceEmpty
์ ์ํด ์ด Publisher๋ ์ฃผ์ด์ง ๊ฐ์ผ๋ก ๋์ฒด๋ ์ ์๋ค.
RxSwift
ifEmpty
์คํผ๋ ์ดํฐ๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌํํ ์ ์๋ค.
ReactiveSwift
ํด๋น ๊ธฐ๋ฅ์ ๊ตฌํํ๊ธฐ ์ํ ์คํผ๋ ์ดํฐ๋ฅผ ์ ๊ณตํ์ง ์๋๋ค.
์ฐธ๊ณ
Last updated
Was this helpful?