RxSugar

Simple RxSwift extensions for interacting with Apple APIs

Showing:

Popularity

Downloads/wk

0

GitHub Stars

77

Maintenance

Last Commit

1yr ago

Contributors

11

Package

Dependencies

1

License

MIT

Categories

Readme

RxSugar Logo RxSugar

Travis CI platforms Carthage compatible pod License

Simple RxSwift extensions for interacting with Apple APIs.

Operators that improve visualization of data flow

observer <~ observable

The <~ subscribes an observer to an observable. Observer can be any ObserverType, Variable, or (value)->()closure. Observable can be any ObservableType, Variable, or ObservableConvertibleType. This operator returns a Disposable.

disposableCollection ++ disposable

The ++ appends a Disposable to a collection of disposables (DisposeBag or CompositeDisposable) and returns the collection.

These operators used in combination result in an easy to visualize data flow:

static func bindView(view: View, model: Model, selectionHandler:(SearchResult)->()) {
    view.rxs.disposeBag
        ++ view.searchResults <~ model.searchResults
        ++ model.searchTerm <~ view.searchTerm
        ++ selectionHandler <~ view.selectionEvents
}

Foundation / UIKit extensions

RxSugar adds Sugar to all NSObjects as a property called rxs. The rxs property contains RxSwift bindings for many common APIs. Here are a few examples:

NSObject

object.rxs.disposeBag - a collection of dispoasables that will be disposed on deinit

UIButton

button.rxs.tap - an Observable<Void> that sends an event on every .TouchUpInside control event.

UITextField

textField.rxs.text - a ValueBinding<String> that sends an event on every .EditingChanged control event and sets the control's text for every event sent to it.

textField.rxs.attributedText - a ValueBinding<NSAttributedString> that sends an event on every .EditingChanged control event and sets the control's attributedText for every event sent to it.

UITextView

Same as UITextField, but using the UITextViewTextDidChangeNotification to drive events

Adding your own Sugar

TargetActionObservable and ValueBinding provide the building blocks for creating your own interface "sugar" similar to the examples above.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100