Adds Publisher.prefix(duration:tolerance:on:in:options:)#27
Adds Publisher.prefix(duration:tolerance:on:in:options:)#27freak4pc merged 4 commits intoCombineCommunity:masterfrom jasdev:david-jasdev-prefix-duration
Conversation
Codecov Report
@@ Coverage Diff @@
## master #27 +/- ##
==========================================
+ Coverage 97.41% 97.42% +0.01%
==========================================
Files 38 40 +2
Lines 2244 2332 +88
==========================================
+ Hits 2186 2272 +86
- Misses 58 60 +2
Continue to review full report at Codecov.
|
…ted values after `duration`). Also, scouted a couple of linter issues in WithLatestFrom.swift. If you want me to split that out into a separate PR, lemme know. 👌🏽 Co-authored-by: David Ohayon <ohayon.1@gmail.com>
|
Should be good for another pass over, thanks for reviewing it! 🙏🏽 |
freak4pc
left a comment
There was a problem hiding this comment.
Final notes ;) Ready to merge after this
jdisho
left a comment
There was a problem hiding this comment.
What can be a use case for this operator? 🤓
| on runLoop: RunLoop = .main, | ||
| in mode: RunLoop.Mode = .default, | ||
| options: RunLoop.SchedulerOptions? = nil) -> Publishers.PrefixUntilOutput<Self, AnyPublisher<Date, Never>> { | ||
| prefix(untilOutputFrom: Timer.publish(every: duration, tolerance: tolerance, on: runLoop, in: mode, options: options) |
There was a problem hiding this comment.
Wondering, why is Apple usingRunLoop and not DispatchQueue?
There was a problem hiding this comment.
Not sure! Maybe some historical reason. 🤔
A use case that came to mind for me is sampling from a publisher with a high value count—e.g. a sequence backing the Twitter firehose and you want to peak into it for a few seconds. |
duration).|
\o/ !! |
Also, scouted a couple of linter issues in WithLatestFrom.swift. If you want me to split that out into a separate PR, lemme know. 👌🏽