RxSwift v1.0 Errata

yeah, we noticed onNext/onCompleted got mixed up in the challenge code - it’s gonna be fixed in next edition :slight_smile: thanks!

:slight_smile:
Another point about Chapter 6 Pg 123 on using takeWhile together with self?.images.value.count ?? 0 ) < 6

We can also make use of takeWhileWithIndex that’s covered in the previous Chapter 5 as the last filter to limit the photo count, to avoid the direct property access that’s mentioned on page. :smile:

.takeWhileWithIndex { image, index in index < 6 }

1 Like

Keep them coming! That’s a great proposal

Challenge
04-observables-in-practice

func showMessage(_ title: String, description: String? = nil) {
alert(title: title, text: description)
  .subscribe(onNext: { [weak self] in
    self?.dismiss(animated: true, completion: nil)
  })
  .addDisposableTo(bag)

}

the onNext: Never be called why you need to put It there?

this has been addressed, will fix in the next edition :slight_smile:

Chapter 2 page 59.

factories that vend => send

Page 137 of print: grant-acecss-alert-boxgrant-access-alert-box

Chapter 7, Getting Started paragraph, there is reference to unicodeDescription(lowercased:). This isn’t found or used in any of the source, and, it’s also not discussed in Chapter 5. I presume this has something to do with example(of:)?

For Chapter 8 Challenge 2, may I suggest instead of convoluting the original

func fetchEvents(repo: String)

into doing more than it should (ignoring its input argument for that matter), we can suggest the reader to create a new function

func fetchTop5Repo() -> Observable<[String]>

that grabs the 5 repo full_name as required and feed it into func fetchEvents(repo: String). The coordination can be done in func refresh() and this should work for the challenge. :]

I was just reading through chapter 4 and on page 78 the book says to add two variables and then mark them as ‘private’ because no other class will be using them. I just wanted to point out that that is not the case.

The ‘private’ marker in Swift 3.0 marks an item as private to the module, which in this case means any other class in the module (project) can access them! To make them truly private for just that class they need to be marked as ‘fileprivate’ :slight_smile:

The apple docs disagree: Access Control — The Swift Programming Language (Swift 5.7)

My apologies! Looks like I misunderstood the change from private → fileprivate and what private means now. Thanks for the link to the docs though!

If you’d like to know how the completed method looks at any point you can always have a look at the completed project. We can’t include the full source code for each file at every step as you can imagine.

I’m looking at the text and not sure what do you find confusing in that part? The text says “Scroll to the top of actionAdd() and alter the first subscription to newPhotos. For the first operator, insert a filter:”

I think a “before” got edited to “for” by mistake and we can fix that, but if you don’t get the expected behavior I can recommend either tracing back your steps through the tutorial or comparing with the completed project included in the chapter.

You also might wanna watch your tone, profanities aren’t generally accepted on these forums no matter if you delete your posts afterwards.

I deleted the question. I don’t believe I used profanity, though my frustration might have come through :slight_smile: My apologies if my frustration reflected in my tone. I have no idea what the issue was that I encountered, but I put down the chapter, came back and started fresh this morning and it worked fine.

Page 95. Typo “Work though all the…” → “Work through all the…”

** Chapter 14 Challenge - Reachability detection problem for iOS 10 simulator:

Reachability detection currently does not work on iOS 10 simulator (tested on iOS 10.3).
Related: Reachability doesn't detect reconnection in iOS 10 Simulator · Issue #151 · ashleymills/Reachability.swift · GitHub

I tested and reachability detection works on an actual iOS device. Please advise the reader to run the challenge on an iOS device or try running it on iOS 9.3 simulator.

Chapter 16, Page 311 - RxBlocking version always succeeds if RxError.timeout is thrown

The test function testColorIsRedWhenHexStringIsFF0000() will always succeed because XCTAssertEqual(result, .red) is skipped whenever the guard clause is triggered, or RxError.timeout is thrown.

Making some changes to the original version,

    func testColorIsRedWhenHexStringIsFF0000() {
        let colorObservable = viewModel.color.asObservable().subscribeOn(scheduler)

        viewModel.hexString.value = "#ff0000"

        var result: UIColor?
        do {
            result = try colorObservable.toBlocking(timeout: 1.0).first()
        } catch {
            print(error)
        }
        XCTAssertEqual(result, .red)
    }

pg. 176 “Nothing happens happen until” → “Nothing happens until”

On pg 205:
“Replace the whole piece of code inside viewDidLoad() that sets updatedCategories with:”

Should be:
“Replace the whole piece of code inside startDownload() that sets updatedCategories with:”

I checked the final project and could not find the suggested code in viewDidLoad() so I think the above is a mistake, otherwise I might just be confused :smile:

1 Like