A collection of small conveniences for RxSwift, intended to promote clarity at the point of use.
See the example project for some demos.
Adds more reactive bindings for common properties, e.g., UIView.tintColor.
Extends CollectiveSwift to provide reactive bindings for collections of common objects. Paired with outlet collections from storyboards, you can do a lot with a little code. For example:
.bind(to: labels.all.rx.textColor, tintableViews.all.rx.tintColor, ...)I often make small observable mappings that feel like clutter. For example:
booleanSource.map { !$0 }
Observable.combineLatest(left, right).map { $0.0 || $0.1 }
typedSource.map { _ in () }.bind(to: voidObserver)But we can make these clearer:
(!booleanSource)
(left || right)
typedSource.trigger(voidObserver)In the case of controls that have unambiguously typed outputs, like buttons (Void),
switches (Bool), and sliders (Float), we can bind and map them directly. For example,
slider.bind(to:) is arguably just as clear as slider.rx.value.bind(to:).
You may prefer, for example, slider.rx.bind(to:), and this is also available.
If you have a strong preference for one over the other, tell me about it!
A nice thing to add to buttons:
button.addPressEffect().disposed(by: ...)...and more!
MIT