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

Block-Style Interaction? #4

Open
geoffreywiseman opened this issue May 8, 2017 · 1 comment
Open

Block-Style Interaction? #4

geoffreywiseman opened this issue May 8, 2017 · 1 comment

Comments

@geoffreywiseman
Copy link

geoffreywiseman commented May 8, 2017

Hey,

It's a matter of taste, but if I were going to use TextFieldCounter (I'm not, currently), I'd prefer a block for handling when max length is reached.

textField.onMaxLengthCrossed { overLimit in
  submitButton.isEnabled = !overLimit
}

I don't love onMaxLengthCrossed as a name, but I couldn't think of anything better right away, so if you decide to add a block handler, maybe you can think of a better name.

On that note, it seems important to have a notification on the delegate if the max limit is "unreached" as well -- for instance in the block above, to re-enable the submit button.

@serralvo
Copy link
Owner

Hello @geoffreywiseman

It's an interesting approach. Feel free to submit a PR with these changes.

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