Skip to content

Adds Publisher.prefix(duration:tolerance:on:in:options:)#27

Merged
freak4pc merged 4 commits intoCombineCommunity:masterfrom
jasdev:david-jasdev-prefix-duration
May 10, 2020
Merged

Adds Publisher.prefix(duration:tolerance:on:in:options:)#27
freak4pc merged 4 commits intoCombineCommunity:masterfrom
jasdev:david-jasdev-prefix-duration

Conversation

@jasdev
Copy link
Member

@jasdev jasdev commented Apr 28, 2020

Also, scouted a couple of linter issues in WithLatestFrom.swift. If you want me to split that out into a separate PR, lemme know. 👌🏽

@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #27 into master will increase coverage by 0.01%.
The diff coverage is 97.72%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
Sources/Operators/WithLatestFrom.swift 93.15% <ø> (ø)
Tests/PrefixDurationTests.swift 97.59% <97.59%> (ø)
Sources/Operators/PrefixDuration.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bd0d0f...e3aa786. Read the comment docs.

jasdev and others added 3 commits May 1, 2020 12:26
…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>
Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some time to do a quick pass, LMK what you think.
Great work, and awesome to see you and @ohayon working on this together 🥇

@jasdev
Copy link
Member Author

jasdev commented May 3, 2020

Should be good for another pass over, thanks for reviewing it! 🙏🏽

@jasdev jasdev requested a review from freak4pc May 3, 2020 22:27
Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final notes ;) Ready to merge after this

Copy link
Contributor

@jdisho jdisho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering, why is Apple usingRunLoop and not DispatchQueue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure! Maybe some historical reason. 🤔

@jasdev jasdev requested a review from freak4pc May 4, 2020 17:28
@jasdev
Copy link
Member Author

jasdev commented May 4, 2020

What can be a use case for this operator?

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.

Copy link

@ohayon ohayon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me!

Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeahhhhhh ⌛

@freak4pc freak4pc changed the title Adds Publisher.prefix(duration:tolerance:on:in:options:) (with defaulted values after duration). Adds Publisher.prefix(duration:tolerance:on:in:options:) May 10, 2020
@freak4pc freak4pc merged commit 5ef4d1d into CombineCommunity:master May 10, 2020
@jasdev jasdev deleted the david-jasdev-prefix-duration branch May 10, 2020 19:31
@ohayon
Copy link

ohayon commented May 12, 2020

\o/ !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants