I'm a newbie in rxSwift. I found some difference when create Observable by
Observable.of
and Observable<String>.create
Observable<String>.create { observer in
observer.onNext("1")
observer.onNext("2")
return Disposables.create()
}.take(3).toArray().subscribe(onNext: { (item) in
print(item)
}).disposed(by: disposeBag)
Not emitted util received at least 3 event. In this way observer never emitted. But with:
Observable.of("1", "2")
// 2
.take(3).toArray()
.subscribe(onNext: {
print($0) })
.disposed(by: disposeBag)
But when i create by this way. Observer always emitted even if i just have 2 elements. I don't known what difference.