-
Notifications
You must be signed in to change notification settings - Fork 5
Proposal: rename / remove "addAction", or add UIButton specific method to attach closure #6
Description
Hi!
Thanks for this little library, I've been using Actions in production and really like it in general.
There's one thing that got me: for UIButtons, I saw that there's an addAction method, and started using it mindlessly, assuming it'd only trigger on .touchUpInside (which is I guess what 99% of the time what you're interested in if you're adding a closure to a button).
Then I kept adding more and more of those to the codebase, and the number of crashes kept increasing, and it has been really hard to figure out where they're coming from.
Then looked into the code and figured that addAction is triggered every time there's a UIControl action is received - but it was definitely not my first thought (basically only figured it out around 2-3 months in)
Which is completely fine, but this was not obvious to me from the method name. :)
Potentially this may have not been an issue if UIButton had a "addOnTouchUp" or a modified "addTap" method?
Is there any real usecase for "addAction" in general? Even using something like "onAnyAction" would make it 100% clear.
I'm writing this because it may happen to some other people, not just me:).