UIButton
can be configured to use different styling, title, etc when the button is enabled or disabled, e.g. with UIButton.setTitle(String, forState:UIControlState)
.
ReactiveCocoa
lets me hook up a ReactiveSwift.Action
to the button's reactive.pressed
property, and if the Action
is disabled the button will show disabled styling: this is great!
But a ReactiveSwift.Action
is also disabled while it has a SignalProducer
in progress. This locking is useful for UI elements attached to slow actions (e.g. network requests) but produces undesirable visual flicker when the action is quick-but-not-instant.
A simple workaround is to not use the builtin UIButton
disabled styling: instead we can expose a Property<Bool>
somewhere and use it both to enable/disable the Action
and to explicitly change the button's styling. This is somewhat clumsy and awkward, however, so my question is: is there a "clean" way to combine the UIButton
builtin disabled styling with disabling the button via explicitly disabling the Action
inside UIButton.reactive.pressed
, without showing the disabled style when the action is in progress?