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 delegate function "ShouldChange" #99

Open
Oggerschummer opened this issue Apr 29, 2020 · 1 comment
Open

Add delegate function "ShouldChange" #99

Oggerschummer opened this issue Apr 29, 2020 · 1 comment

Comments

@Oggerschummer
Copy link

Hi,
may I propose some enhancement:
It would be beneficial to have a delegate function like "shouldChange" with Bool result that gets called just before any state change (selected, unselected) happens triggered form UI.
In case the delegate returns false, no change happens and the box stays as it is.
Default behaviour: Allow changes.
Something similar is available e.g. for UITextField.
I have situations, where I need to run checks or calculations before allowing to switch the state. In addition the state sometimes is populated from a popup where multiple entries are required to allow the state become true - clicking on the checkbox with this delegate function would allow me to trigger the popup easily and avoid the user being able to manually check the box.
Would keep things simple and avoid having to work with additional gesture recognizers above the box.
Regards
Oggerschummer

@Boris-Em
Copy link
Owner

Boris-Em commented Oct 2, 2020

This is a good idea, and it should be fairly trivial to implement.
We need to make sure that this delegate function is optional.

Feel free to contribute to the codebase by opening a PR @Oggerschummer!

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

No branches or pull requests

2 participants