a guest Jan 18th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # combine
- - 같은 타입만 가능
- ## startWith
- - Prepends a sequence of values to an observable sequence.
- - 초기 상태를 지정해줄 수 있다
- ## concat
- - class method
- - Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.
- ## concat(_:)
- - instance method
- - Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.
- ## concatMap
- - Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.
- - flatMap처럼 이전 시퀀스가 완료된 후 다음 시퀀스를 구독하므로 순서를 보장한다
- ## merge
- - Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.
- - emits the elements as soon as they arrive — there’s no predefined order.
- ## merge(maxConcurrent:)
- - Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
- ## combineLatest
- - Merges the specified observable sequences into one observable sequence whenever **any of the observable sequences produces an element.**
- - 다른 타입의 시퀀스를 결합할 수 있다!!!
- ## zip
- - Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a **corresponding index.**
- ## withLatestFrom(_:)
- - Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when self emitts an element
- - you want the current (latest) value emitted from an observable, but only when a particular trigger occurs.
- - 버튼 눌러서 최신값 얻고 싶을 때
- ## sample(_:)
- - Samples the source observable sequence using a sampler observable sequence producing sampling ticks.
- - **In case there were no new elements between sampler ticks, no element is sent to the resulting sequence.**
- - 버튼 눌러서 최신값 얻을 수 있으나 최신값이 변하지 않았으면 버튼 눌러도 방출 안함
- ## amb
- - Propagates the observable sequence that reacts first.
- - 두 시퀀스를 구독해서 둘 중 늦게 방출하는 시퀀스를 구독해지한다
- - 여러 서버중에 제일 먼저 응답하는 서버로 연결하기
- ## switchLatest()
- - Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence
- - Each time a new inner observable sequence is received, unsubscribe from the previous inner observable sequence.
- - flatMapLatest 처럼 최근 구독만 유지
- ## reduce
- - 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.
- - produces its summary (accumulated) value only when the source observable completes
- - 완료시점에만 누적값을 방출
- ## scan
- - Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.
- - 입력값이 추가될때마다 그때까지의 누적값을 방출
- - local variable을 따로 만들지 않아도 상태변화를 추적할 수 있다
RAW Paste Data