Quantcast
Channel: Combine: Asynchronous Programming with Swift - Kodeco Forums
Viewing all articles
Browse latest Browse all 26

Chapter 18: Purpose of .max(1)

$
0
0

In chapter 18, when defining the DispatchTimerSubscription you use

self.requested -= .max(1)
self.timer -= .max(1)

and I wonder what .max(1) actually does and why it’s needed.
I imaging it creates a new Demand object, initialized by 1 and then subtracts that one from either requested or timer.
I wonder why one couldn’t simply write

self.requested -= 1
self.timer -= 1

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 26

Trending Articles