This is Understanding Combine, written by Matt Neuburg. It is a work in progress. Corrections and suggestions are greatly appreciated (you can comment here). So are donations; please consider keeping me going by funding this work at Or buy my books: the current editions are iOS 13 Programming Fundamentals with Swift and Programming iOS 13. Thank you!


.measureInterval reports the time interval elapsed between the currently received value and the previously received value. The first time interval reported is the time between subscription and the receipt of the first value.

The parameters are (see .delay for more information):

The queue or runloop on which the time is to be measured.
Optional. You’ll usually omit it.

Time intervals are reported as Stride structs; the actual time is the struct’s magnitude property, whose size depends on the scheduler. For a DispatchQueue, it is an Int reporting nanoseconds. So, for example, to get the time interval in seconds, you could say:

.measureInterval(using: DispatchQueue.main)
.map {Double($0.magnitude)/1000000000}

But for an OperationQueue or RunLoop, it is a Double reporting seconds, so the .map would be unnecessary.

Table of Contents