Closed genkernel closed 6 years ago
Thanks for suggestions. I've made the changes but I haven't deprecated the old implementation yet. Release 2.0.5 will be available soon.
Hey, thank you for adding this functionality!
Maybe consider not deprecating property-based setup and just support both styles in favor of all other devs who use library.
Quick note, I updated my code and found that when I call addHaptic(...), method does not set 'hapticType'. Thus it does not enable hapticable behavior.
Fixed 🙂
There is no real issue and this topic is more of an observation type.
Q.1: I used Haptica as:
My initialization logic has a flaw since button.isHaptic = true immediately triggers a call to addTarget() with .touchDown as default value (if hapticControlEvents is not set). Hence hapticControlEvents should be initialized before button.isHaptic = true invocation to make any effect.
Would this make sense to refactor and introduce methods like these:
to enable 1 line setup? Methods naming strategy 'addHaptic', 'removeHaptic' stolen from 'addTarget', 'removeTarget'.
Q.2: Does it make sense to implement Hapticable for UIControl rather than UIButton? (since addTarget and removeTargets methods implemented in UIControl). This would enable Haptics for elements like UISwitch.