create an Observable that emits a particular item
just
just
just return
of
just sequenceOf
In Swift, this is implemented using the Observable.just
class method.
The parameter, whether a tuple (i.e. (1, 2, 3)
) or an array (i.e. [1,2,3]
) is produced as one emission.
let source = Observable.just(1, 2, 3) source.subscribe { print($0) } let source2 = Observable.just([1,2,3]) source2.subscribe { print($0) }
next((1, 2, 3)) completed next([1, 2, 3]) completed
The difference between this and Observable.from
is that the latter's parameter is an array or a sequence, and emits each of its element as one emission.
© ReactiveX contributors
Licensed under the Apache License 2.0.
http://reactivex.io/documentation/operators/just.html