Skip to content
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

Fixes & additional updates #53

Merged
merged 11 commits into from
Oct 16, 2020
Merged

Fixes & additional updates #53

merged 11 commits into from
Oct 16, 2020

Conversation

stephanecopin
Copy link
Contributor

@stephanecopin stephanecopin commented Oct 9, 2020

Goals ⚽

This PR:

  • Add an optional insets parameter to addAndFitSubview(), which should be self-explanatory
  • Make removeArrangedSubviews()'s removeFromHierachy parameter default to true
  • Fix an internal state corruption issue in OrderedSet, and make it conform to SetAlgebra
  • Add tapped helper to link any Action to any UIControl
  • Add AnyIdentifiable & AnyAction for type-erased Identifiable & ReactiveActionProtocol respectively
  • Add OverridingAction, a new Action that if executed when already executing, will cancel the current one and start anew

Backwards-compatibility:

All changes are additive and doesn't break backward compatibility.

Testing Details 🔍

Unit tests were added for OrderedSet.

@stephanecopin stephanecopin requested a review from a team October 9, 2020 19:27
/// protocol to represents the button rather than hardcode it to classes,
/// allowing for any `UIControl` to use this method.
///
var tapped: TapAction<Base>? {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd welcome a new name here, as pressed is already used, and they semantically are pretty much the same

Copy link
Member

@metatheoretic metatheoretic left a comment

Choose a reason for hiding this comment

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

💯

self.applyClosure = { action.apply($0 as! Action.Input).map { $0 }.mapError { $0 } }
self.events = action.events.map { $0.map { $0 }.mapError { $0 } }
self.values = action.values.map { $0 }
self.errors = action.errors.map { $0 }

Choose a reason for hiding this comment

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

can we write

self.values = action.values
self.errors = action.errors

is .map { $0 } required ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@harishsaini it is, to convert to Any or Error through type inference. I could have added as Any in the maps and as Error in the mapError, but I figured it wasn't necessary as it's a common-ish pattern in Swift

@codecov
Copy link

codecov bot commented Oct 15, 2020

Codecov Report

❗ No coverage uploaded for pull request base (develop@e0c6011). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             develop     #53   +/-   ##
=========================================
  Coverage           ?   7.34%           
=========================================
  Files              ?      60           
  Lines              ?    1729           
  Branches           ?       0           
=========================================
  Hits               ?     127           
  Misses             ?    1602           
  Partials           ?       0           

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 e0c6011...29be1b6. Read the comment docs.

@stephanecopin stephanecopin force-pushed the misc/updates branch 4 times, most recently from 6fc6b8a to 6963623 Compare October 16, 2020 18:15
@Fueled Fueled deleted a comment from CatalyticBot Oct 16, 2020
@stephanecopin stephanecopin merged commit 484b505 into develop Oct 16, 2020
@stephanecopin stephanecopin deleted the misc/updates branch October 16, 2020 19:20
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.

3 participants