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

Add isEnabledPublisher to UIButton #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

darko55555
Copy link

Added isEnabled publisher to UIButton

Example of usage, assign to isEnabledPublisher for form validation.

@codecov
Copy link

codecov bot commented Feb 7, 2021

Codecov Report

Merging #37 (ab9248d) into main (749c166) will decrease coverage by 0.37%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
- Coverage   70.94%   70.56%   -0.38%     
==========================================
  Files          28       28              
  Lines         561      564       +3     
==========================================
  Hits          398      398              
- Misses        163      166       +3     
Impacted Files Coverage Δ
...urces/CombineCocoa/Controls/UIButton+Combine.swift 40.00% <0.00%> (-60.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 749c166...37d88af. Read the comment docs.

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.

Thank you @darko55555 !
Great addition, and the code looks good -

But, isEnabled is on UIControl, so sounds like there's an opportunity to have it for all UIControls.

Mind moving it to an appropriate extension and add a quick test for it in our test suite?

Thank you :)

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.

Thanks! Quick note.

@@ -16,5 +16,10 @@ public extension UIButton {
var tapPublisher: AnyPublisher<Void, Never> {
controlEventPublisher(for: .touchUpInside)
}

var isEnabledPublisher: AnyPublisher<Bool, Never> {
Copy link
Member

Choose a reason for hiding this comment

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

Might make more sense for UIControl as a whole

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.

2 participants