TakeLast
/**
Returns a specified number of contiguous elements from the end of an observable sequence.
This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
- seealso: [takeLast operator on reactivex.io](<http://reactivex.io/documentation/operators/takelast.html>)
- parameter count: Number of elements to take from the end of the source sequence.
- returns: An observable sequence containing the specified number of elements from the end of the source sequence.
*/
public func takeLast(_ count: Int)
-> Observable<Element> {
TakeLast(source: self.asObservable(), count: count)
}
- 예)
takeLast(1)
연산자를 사용하면, 제일 마지막 1개의 이벤트만 가져온다.