RXSwift with one time subscriber

rx-swift, subscriber, swift

Solution

just use take operator :)

yourObservable.take(1).subscribe(....

Problem

I want to subscribe to an observable, but right after the first element, I want to dispose the subscriber. Is there some default way for that? If not, how would you solve this? I cannot change the observable, by the way.

Original source