-
Notifications
You must be signed in to change notification settings - Fork 163
Implementation of FlatMapFirst operator #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of FlatMapFirst operator #119
Conversation
Sources/Operators/FlatMapFirst.swift
Outdated
isRunning = newValue | ||
} | ||
|
||
return self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea for an implementation! Also seems like a good test suite to cover it.
Can you remove the explicit self here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it should be gone...
5d116e5
to
88c7425
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long! I'd like to merge this, just a quick note on the test naming and we can go ahead. @troupmar
If you don't have the time let me know and I'll do my best to take care of it myself.
Tests/FlatMapFirstTests.swift
Outdated
XCTAssertTrue(isUpstreamCompleted) | ||
} | ||
|
||
func test_flatMapFirst_error_upstream_skipping_flatMap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the naming to not use underscores?
I believe that's not really common practice in Swift.
Could also be a bit denser. Since we are in flatMapFirstTests, there's no need for test_flatMapFirst
prefix. You can just call it testErrorSkipsFlatmap
, or however you'd like. (This applies to the other tests too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it renamed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems likje a minor conflict to fix and then we can merge :) thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, sorry. I resolved it.
3b328b3
to
2b1b328
Compare
Still conflicted @troupmar :) |
2b1b328
to
78c0db4
Compare
There were new conflicts introduced, I guess. But I resolved them as well! Still waiting for "1 workflow awaiting approval" ;) |
Codecov Report
@@ Coverage Diff @@
## main #119 +/- ##
==========================================
- Coverage 95.51% 95.45% -0.06%
==========================================
Files 70 72 +2
Lines 4166 4266 +100
==========================================
+ Hits 3979 4072 +93
- Misses 187 194 +7
Continue to review full report at Codecov.
|
Thank you! |
Thanks for the assist! :) |
FlatMapFirst
operator is a special case offlatMap
operator.Like
FlatMapLatest
, it only allows one inner publisher at a time. UnlikeFlatMapLatest
, it will not cancel an ongoing inner publisher.Instead it ignores events from the source until the inner publisher is done. It creates another inner publisher only when the previous one is done.
Sources: