Errata for Combine: Asynchronous Programming with Swift 1st Edition

Creating this topic to catch any typos and bugs in the 1st Edition of Combine: Asynchronous Programming with Swift.

in v0.2.0.pdf; page 36
pretty sure that rather than
Finish the Publisher example from earlier by adding the following code:

was intended to say
Finish the Subscriber example from earlier by adding the following code:
(was last discussed on page 33)

1 Like

Got a few typos from v0.2 - sentences, page numbers and assumed fixed shown below:

P28

  • subscribers to consume the results do something useful with them
  • subscribers to consume the results and do something useful with them

p34

  • Create a publisher using Just, which lets you a publisher from a primitive value type

  • Create a publisher using Just, which lets you create a publisher from a primitive value type

  • Try adding another subscriber by adding the following code to the and of your example:

  • Try adding another subscriber by adding the following code to the end of your example:

p36

  • AnyCancellable conforms the Cancellable protocol
  • AnyCancellable conforms to the Cancellable protocol

P37

  • if you don’t store a subscription in full projects, that subscription will cancel as soon as the program flow exits the scope in which is was created!

  • if you don’t store a subscription in full projects, that subscription will cancel as soon as the program flow exits the scope in which it was created!

Page Headings

Headings for each page like in Chapter 2 are messed up

1 Like

@seano Great catch, thanks! :man_bowing:t2:

This will be fixed in the next release.

@swiftlearnerforlife You win the :eagle::eyes::trophy: !

These typos will be fixed in the next release, and I’ll raise the page heading issue with team responsible for that part.

Thanks again! :man_bowing:t2:

going through chapter 1 of the EA and typing in all the examples

and I noticed that part of the code is commented out in the playground. Any reason?

hmm it looks like the print statements only write to console when stepping through the code. I gather there’s a printing from worker thread to main UI thread issue? Is that why the code is commented out in the playground?

The code that is commented out — a Future example — has delayed output. So if you left it uncommented, its output would be printed below the forthcoming example headers.

From the chapter:

Before moving on, comment out the entire "Future" example, so the future isn’t invoked every time you run the playground — otherwise its delayed output will be printed after the last example.

1 Like

Hi Scott

I found a couple more errors in later chapters , please see below.

P100

  • Use prefix(while:) to let values through as long as they’re smaller than 3. As
    soon as a value smaller than 3 is emitted, the publisher completes.
  • Use prefix(while:) to let values through as long as they’re smaller than 3. As
    soon as a value equal or larger than 3 is emitted, the publisher completes.

Diagram in page 100

  • The isReady dot needs to be moved before tap 3. Is currently before tap 4.

P106

  • Create a publisher that emits numbers between 4 and 7.

  • Create a publisher that emits numbers between 3 and 4 .

  • Use prepend to add the numbers 1 , 2 and 3 before the publisher’s own elements

  • Use prepend to add the numbers 1 and 2 before the publisher’s own elements

P108

  • Create a publisher that emits numbers between 4 and 7.
  • Create a publisher that emits numbers between 5 and 7.

P119

  • Send publisher3, which cancels the subscription to publisher2. As before, you send 6 to publisher2 and it’s ignored, and then send 6 , 7, 8 and 9, which are pushed through the chain.
  • Send publisher3, which cancels the subscription to publisher2. As before, you send 6 to publisher2 and it’s ignored, and then send 7, 8 and 9, which are pushed

p120
For the network request code you need to import UIKit to use UIImage - probably worth letting the reader know that they need to add it or you could just replace import Foundation with import UIKit in the starter Playground.

Btw keep up the great work. I’m excited to build my next personal iOS project using Combine and SwiftUI and can’t wait for the full releases of both related books, particularly Combine. Just need to convince my team at work to use them both for the total win (which will be pretty tough as we still support iOS 9 :sleeping: :sob:).

2 Likes

Wow, thanks for the valuable feedback! It really helps improve the book for all readers :+1:t3:

No problem. Happy to help and will be ready to look into future releases as soon as possible when they become available.

Thank you so much for your feedback! Early access editions are an awesome time to get this feedback address and every piece of your feedback will make the book even better! @swiftlearnerforlife
:smile_cat:

No problem. Any idea when your next release will be? Getting slightly blocked on the best way to make api calls with Combine so really looking forward to the networking chapter!

We’re not ready to publicly announce the release date - the most I can say is it won’t be too much longer! :]

2 Likes

page 58, last paragraph of Solution section doesn’t seem to belong there.

FYI - sharing the names of the chapters will be immensely helpful for Errata of all sorts. Thanks!

Page 66: The output from the map key paths example contains one more item than present in the example above.

Page 67: The example output does not match example code. Example code does not prefix the strings with “[name] wrote:”

Page 90: 2. Use the last(where:) operator to find the last emitted even value.

Page 106: The prepend(Output…) code and description of what is happening don’t match

Page 120: switchToLatest example needs import of UIKit too

Hey all!
I’m happy to say all of your notes have been applied to the last EA 3 release !

Please, keep sending us your feedback before the final release — you’ve all been an amazing help for polishing this book so we can deliver to best book to you, and other readers :slight_smile:

Thank you from the entire book team.

would be helpful to use the v0.2.0 numbering in comments like this because I don’t see the “EA 3” on the PDF anywhere. (thanks for versioning the PDFs clearly!)

Same point as Errata for Combine: Asynchronous Programming with Swift 1st Edition - #15 by gilroykilroy I think, but with specific reference due to freak4pc comment:

In the Challenge portion of Chapter 2 right above “Key points” (page 58 on my screen for v0.2.0), this text seems likely to have been from something entirely different since neither “CurrentValueSubject” or “loggedOut” are used in the challenge code and the line in question is printed out because “example( of: String … )” prints out the string passed in.

The first line printed is because you used a CurrentValueSubject with an initial

value of loggedOut.