-
Notifications
You must be signed in to change notification settings - Fork 287
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
Labels
Comments
This is a good idea, and it should be fairly trivial to implement. 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
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
The text was updated successfully, but these errors were encountered: