Just

์ œ๋„ค๋ฆญ ๊ตฌ์กฐ์ฒด | ๊ฐ๊ฐ์˜ Subscriber์—๊ฒŒ ์˜ค์ง ํ•œ ๋ฒˆ๋งŒ ์ถœ๋ ฅ์„ ๋‚ด๊ณ  ์ข…๋ฃŒํ•˜๋Š” Publisher

์ด๋‹ˆ์…œ๋ผ์ด์ €๋Š” ํ•œ ๊ฐœ์˜ ์ธ์ž๋ฅผ ๋ฐ›๋Š”๋‹ค.

  • output : Publihser๊ฐ€ ๋ฐฐ์ถœํ•  ํ•œ ๊ฐœ์˜ ์š”์†Œ

๊ธฐ๋ณธ์ ์ธ Publisher ์ค‘ ํ•˜๋‚˜๋กœ, Convenience Publisher๋กœ ์ •์˜๋˜์–ด ์žˆ์–ด Publishers ์—ด๊ฑฐํ˜•์— ์†ํ•ด ์žˆ์ง€ ์•Š๊ณ  ๋‹จ๋…์ ์ธ ๊ตฌ์กฐ์ฒด์˜ ํ˜•ํƒœ๋ฅผ ๊ฐ–๋Š”๋‹ค.

๊ฐ’์„ ๋‚ด๊ณ  ์ข…๋ฃŒํ•˜๋Š” ๊ฒƒ๊ณผ ์—๋Ÿฌ๋ฅผ ๋‚ด์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์„ ๋ณด์žฅํ•œ๋‹ค.

Just("Combine Just")
  .sink(receiveValue: { print($0) })
  .store(in: &cancellables)

// Combine Just

RxSwift

just ์˜คํผ๋ ˆ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋‹ค.

Observable.just("RxSwift Just")
  .subscribe(onNext: { print($0) })
  .disposed(by: disposeBag)

// RxSwift Just

ReactiveSwift

init(value:) ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋‹ค.

SignalProducer(value: "ReactiveSwift Just")
  .startWithValues { print($0) }

// ReactiveSwift Just

์ฐธ๊ณ 

ReactiveX - Operators - Just

Last updated