I’m trying to understand this operator, in chapter says it says:
takes elements from the source sequence for the given time period. Once the time interval has passed, the resulting sequence completes.
I tried that bymself in a little example:
let test = PublishSubject<Int>()
test
.take(5.0, scheduler: MainScheduler.instance)
.subscribe(onNext: { value in
print(value)
}, onError: nil, onCompleted: {
print("completed")
}) {
print("disposed")
}
test.onNext(3)
And the result ouput is just “3”.
Isn’t supposed after those 5 seconds to be completed?