Group Group Group Group Group Group Group Group Group

Chapter 10 comment - page 217

The explanation of reason to use concat(_ : ) operator in the following code:

eoCategories
.concat(updatedCategories)
.bind(to: categories)

was a bit unclear for me (as a beginner).
Sure, this works fine and as explained, but the following worked fine as well:

updatedCategories
.bind(to: categories)

i.e. without concat()!?
To make the explanation somewhat clear I replaced

let downloadedEvents = EONET.events(forLast: 360)

with following (i.e. poor connection):

let downloadedEvents = Observable<[EOEvent]>.create { observer in
  return Disposables.create()
}

In this case updatedCategories emits nothing and we will not see even categories.
BTW, it is mentioned in the note on the page 194 that combineLatest emits something only in case when both sources emit at least one non-stop event.
Like if in the above code to add

observer.onNext([])

categories will appear, although with count (0).

@fpillet Can you please help with this when you get a chance? Thank you - much appreciated! :]

I believe, after the first piece of code there should be added some explanation why do we need to concat eoCategories and updatedCategories.
Maybe with reference to that page #194 I mentioned at the end.

This topic was automatically closed after 166 days. New replies are no longer allowed.