Group Group Group Group Group Group Group Group Group

Chapter 6: Throttle, playground results differ from the book results

Hello,
First and foremost, I am really happy with the book and I think you did an outstanding job!
I am reading the book and going through all the examples in the playground and I noticed that in Chapter 6 for the throttle examples the playground produce different results than the book. I even tried the Final.playground to eliminate any error I might have introduced myself.
This is the view output from the live view:

image

And in the book:

image

The result from the debug console from the playground:

+0.0s: Subject emitted: H
+0.0s: Throttle emitted: H
+0.1s: Subject emitted: He
+0.2s: Subject emitted: Hel
+0.3s: Subject emitted: Hell
+0.5s: Subject emitted: Hello
+0.6s: Subject emitted: Hello 
+1.1s: Throttle emitted: He
+2.2s: Subject emitted: Hello W
+2.2s: Subject emitted: Hello Wo
+2.2s: Throttle emitted: Hello W
+2.4s: Subject emitted: Hello Wor
+2.4s: Subject emitted: Hello Worl
+2.7s: Subject emitted: Hello World
+3.4s: Throttle emitted: Hello Wor

and the one from the book:

“+0.0s: Subject emitted: H
+0.1s: Subject emitted: He
+0.2s: Subject emitted: Hel
+0.3s: Subject emitted: Hell
+0.5s: Subject emitted: Hello
+0.6s: Subject emitted: Hello 
+1.0s: Throttled emitted: H
+2.2s: Subject emitted: Hello W
+2.2s: Subject emitted: Hello Wo
+2.2s: Subject emitted: Hello Wor
+2.4s: Subject emitted: Hello Worl
+2.7s: Subject emitted: Hello World
+3.0s: Throttled emitted: Hello W”

Excerpt From: By Marin Todorov. “Combine.” Apple Books. 

I am a beginner in Combine but the results I get from the playground makes more sense than what is explained in the book.
I am using Xcode 11.3.1 with macOS 10.15.3 and reading what is at the time of writing the latest version of the book 1.0.2

Thank you!

I noticed that throttle will always fire the first value if there is any no matter if latest is set to true or false. What differs in the next throttle event after 1 second is the “index” of the sequence of values published differs depending on the latest parameter which can either be the first or last index after the last fired value.

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