✨
Combine 🀝 RxSwift 🀝 ReactiveSwift
  • Combine 🀝 RxSwift 🀝 ReactiveSwift
  • Publisher
    • Publishers.Merge
    • Publishers.Zip3
    • Publishers.TryScan
    • Publishers.MergeMany
    • Publishers.Breakpoint
    • AnyPublisher
    • Publishers.Concatenate
    • Publishers.Drop
    • Publishers.Decode
    • Publishers.TryCompactMap
    • Publishers.CombineLatest4
    • Optional.Publisher
    • Publishers.CollectByCount
    • Publishers.TryFilter
    • Publishers.CombineLatest3
    • Publishers.TryContainsWhere
    • Just
    • Publishers.TryFirstWhere
    • Publishers.MapError
    • Publishers.RemoveDuplicates
    • Result.Publisher
    • Publishers.LastWhere
    • Publishers.First
    • Publishers.Throttle
    • Publishers.DropUntilOutput
    • Publishers.Count
    • Publishers.Comparison
    • Publishers.Debounce
    • Publishers.MapKeyPath
    • Publishers.CollectByTime
    • Publishers.TryDropWhile
    • Empty
    • Publishers.PrefixUntilOutput
    • Publishers.Print
    • URLSession.DataTaskPublisher
    • Publishers.Reduce
    • Publishers.MapKeyPath3
    • Publishers.Collect
    • Publishers.TryPrefixWhile
    • Publishers.MapKeyPath2
    • Future
    • Publishers.SubscribeOn
    • Publishers.AllSatisfy
    • Publishers.Retry
    • Publishers.ContainsWhere
    • Publishers.SetFailureType
    • Publishers.TryMap
    • Publishers.Output
    • Publishers.TryRemoveDuplicates
    • Publishers.HandleEvents
    • Publishers.Sequence
    • Publishers.TryCatch
    • Publishers.Merge8
    • Publishers.CombineLatest
    • Deferred
    • Publishers.Merge7
    • Publishers.Contains
    • Fail
    • Publishers.Merge6
    • Publishers.TryComparison
    • Publishers.Delay
    • Publishers.Scan
    • Publishers.Merge5
    • Publishers.MeasureInterval
    • Publishers.AssertNoFailure
    • Publishers.ReceiveOn
    • Publishers.Merge4
    • Publishers.DropWhile
    • Publishers.Merge3
    • Publishers.TryReduce
    • Publishers.Zip
    • Publishers.Timeout
    • Publishers.CompactMap
    • Publishers.ReplaceEmpty
    • Publishers.PrefixWhile
    • Publishers.Filter
    • Publishers.TryAllSatisfy
    • Publishers.FirstWhere
    • Publishers.Last
    • Publishers.Map
    • Publishers.SwitchToLatest
    • Publishers.TryLastWhere
    • Publishers.Encode
    • Publishers.Catch
    • Publishers.ReplaceError
    • Pulishers.IgnoreOutput
    • Publishers.Zip4
  • Subject
    • PassthroughSubject
    • CurrentValueSubject
  • Subscriber
Powered by GitBook
On this page
  • RxSwift
  • ReactiveSwift
  • μ°Έκ³ 

Was this helpful?

  1. Publisher

Pulishers.IgnoreOutput

μ œλ„€λ¦­ ꡬ쑰체 | μƒμœ„μ— 흐λ₯΄λŠ” μš”μ†ŒλŠ” λͺ¨λ‘ λ¬΄μ‹œν•˜λ‚˜, μ™„λ£Œ μƒνƒœ(μ’…λ£Œ λ˜λŠ” μ‹€νŒ¨)λŠ” λ”°λ₯΄λŠ” Publisher

μ΄λ‹ˆμ…œλΌμ΄μ €λŠ” ν•œ 개의 인자λ₯Ό λ°›λŠ”λ‹€.

  • upstream : μƒμœ„μ— 흐λ₯΄λŠ” Publisher

μƒμœ„μ— 흐λ₯΄λŠ” Publisher의 μ—λŸ¬λ‚˜ μ™„λ£Œμ™€ 같은 μ™„λ£Œ μƒνƒœλ§Œ λ°›μ•„ μ²˜λ¦¬ν•˜κ³  싢을 λ•Œ μ‚¬μš©ν•  수 μžˆλ‹€.

ignoreOutput μ˜€νΌλ ˆμ΄ν„°μ™€ 관련이 μžˆλ‹€.

// Publishers.IgnoreOutput Publisher
Publishers
  .IgnoreOutput(upstream: Publishers.Sequence<[Int], Never>(sequence: [1, 2, 3]))
  .sink(receiveCompletion: { completion in
    switch completion {
    case .failure:
      print("Combine IgnoreOutput Error")
    case .finished:
      print("Combine IgnoreOutput Finish")
    }
  }, receiveValue: { value in
    print("Combine IgnoreOutput : \(value)")
   })
  .store(in: &cancellables)

// ignoreOutput Operator
Publishers.Sequence<[Int], Never>(sequence: [1, 2, 3])
  .ignoreOutput()
  .sink(receiveCompletion: { completion in
    switch completion {
    case .failure:
      print("Combine IgnoreOutput Error")
    case .finished:
      print("Combine IgnoreOutput Finish")
    }
  }, receiveValue: { value in
    print("Combine IgnoreOutput : \(value)")
  })
  .store(in: &cancellables)

// Combine IgnoreOutput Finish

μƒμœ„ Publisherκ°€ 1, 2, 3의 값을 μ°¨λ‘€λŒ€λ‘œ λ‚΄μ§€λ§Œ ignoreOutput에 μ˜ν•΄ λͺ¨λ‘ λ¬΄μ‹œλ˜κ³ , μ •μƒμ μœΌλ‘œ μ’…λ£Œν•˜κΈ° λ•Œλ¬Έμ— μ’…λ£Œμ— λŒ€ν•΄μ„œλ§Œ μ²˜λ¦¬ν•œλ‹€.

RxSwift

ignoreElements μ˜€νΌλ ˆμ΄ν„°λ₯Ό μ‚¬μš©ν•˜μ—¬ κ΅¬ν˜„ν•  수 μžˆλ‹€.

Observable.from([1, 2, 3])
  .ignoreElements()
  .subscribe(onCompleted: {
    print("RxSwift IgnoreOutput Finish")
  }, onError: { _ in
    print("RxSwift IgnoreOutput Error")
  })
  .disposed(by: disposeBag)

// RxSwift IgnoreOutput Finish

ReactiveSwift

ν•΄λ‹Ή κΈ°λŠ₯을 κ΅¬ν˜„ν•  수 μžˆλŠ” 방법을 μ œκ³΅ν•˜μ§€ μ•ŠλŠ”λ‹€.

μ°Έκ³ 

PreviousPublishers.ReplaceErrorNextPublishers.Zip4

Last updated 5 years ago

Was this helpful?

ReactiveX - Operators - IgnoreElements