Guest User

Untitled

a guest
Jan 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. # combine
  2. - 같은 타입만 가능
  3.  
  4.  
  5. ## startWith
  6. - Prepends a sequence of values to an observable sequence.
  7. - 초기 상태를 지정해줄 수 있다
  8.  
  9.  
  10. ## concat
  11. - class method
  12. - Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.
  13.  
  14.  
  15. ## concat(_:)
  16. - instance method
  17. - Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.
  18.  
  19.  
  20. ## concatMap
  21. - Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.
  22. - flatMap처럼 이전 시퀀스가 완료된 후 다음 시퀀스를 구독하므로 순서를 보장한다
  23.  
  24.  
  25. ## merge
  26. - Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.
  27. - emits the elements as soon as they arrive — there’s no predefined order.
  28.  
  29.  
  30. ## merge(maxConcurrent:)
  31. - Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
  32.  
  33.  
  34. ## combineLatest
  35. - Merges the specified observable sequences into one observable sequence whenever **any of the observable sequences produces an element.**
  36. - 다른 타입의 시퀀스를 결합할 수 있다!!!
  37.  
  38.  
  39. ## zip
  40. - Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a **corresponding index.**
  41.  
  42.  
  43. ## withLatestFrom(_:)
  44. - Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emitts an element
  45. - you want the current (latest) value emitted from an observable, but only when a particular trigger occurs.
  46. - 버튼 눌러서 최신값 얻고 싶을 때
  47.  
  48.  
  49. ## sample(_:)
  50. - Samples the source observable sequence using a sampler observable sequence producing sampling ticks.
  51. - **In case there were no new elements between sampler ticks, no element is sent to the resulting sequence.**
  52. - 버튼 눌러서 최신값 얻을 수 있으나 최신값이 변하지 않았으면 버튼 눌러도 방출 안함
  53.  
  54.  
  55.  
  56.  
  57. ## amb
  58. - Propagates the observable sequence that reacts first.
  59. - 두 시퀀스를 구독해서 둘 중 늦게 방출하는 시퀀스를 구독해지한다
  60. - 여러 서버중에 제일 먼저 응답하는 서버로 연결하기
  61.  
  62.  
  63. ## switchLatest()
  64. - Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence
  65. - Each time a new inner observable sequence is received, unsubscribe from the previous inner observable sequence.
  66. - flatMapLatest 처럼 최근 구독만 유지
  67.  
  68.  
  69. ## reduce
  70. - Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
  71. - produces its summary (accumulated) value only when the source observable completes
  72. - 완료시점에만 누적값을 방출
  73.  
  74.  
  75. ## scan
  76. - Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.
  77. - 입력값이 추가될때마다 그때까지의 누적값을 방출
  78. - local variable을 따로 만들지 않아도 상태변화를 추적할 수 있다
Add Comment
Please, Sign In to add comment