All Projects → RxSwiftCommunity → RxBinding

RxSwiftCommunity / RxBinding

Licence: MIT license
Simple data binding operators ~> and <~> for RxSwift.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to RxBinding

Slim.js
Fast & Robust Front-End Micro-framework based on modern standards
Stars: ✭ 789 (+1193.44%)
Mutual labels:  data-binding
Playground
Playground
Stars: ✭ 108 (+77.05%)
Mutual labels:  data-binding
Paginglibrary Sample
An open source app that is refactored to demo Paging Library from Android Jetpack
Stars: ✭ 165 (+170.49%)
Mutual labels:  data-binding
Observer Util
Transparent reactivity with 100% language coverage. Made with ❤️ and ES6 Proxies.
Stars: ✭ 905 (+1383.61%)
Mutual labels:  data-binding
Lychee
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.
Stars: ✭ 102 (+67.21%)
Mutual labels:  data-binding
Ngx Context
Angular Context: Easy property binding for router outlet and nested component trees.
Stars: ✭ 118 (+93.44%)
Mutual labels:  data-binding
Countries
An example Android app using Retrofit, Realm, Parceler, Dagger and the MVVM pattern with the data binding lib.
Stars: ✭ 616 (+909.84%)
Mutual labels:  data-binding
Handsontable
JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
Stars: ✭ 16,059 (+26226.23%)
Mutual labels:  data-binding
Constraintlayout Sample
A demo app to showcase constraint layout implementation in Android
Stars: ✭ 103 (+68.85%)
Mutual labels:  data-binding
Mvvmarchitecture
An example Android app using Retrofit, Room, LiveData, RxJava2, Paging, Koin and the MVVM pattern with the databinding
Stars: ✭ 160 (+162.3%)
Mutual labels:  data-binding
Tokamak
SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms
Stars: ✭ 1,083 (+1675.41%)
Mutual labels:  data-binding
Alfonz
Mr. Alfonz is here to help you build your Android app, make the development process easier and avoid boilerplate code.
Stars: ✭ 90 (+47.54%)
Mutual labels:  data-binding
Binding.scala
Reactive data-binding for Scala
Stars: ✭ 1,539 (+2422.95%)
Mutual labels:  data-binding
Bindingrx
🔗Data binding components for Unity3d upm package
Stars: ✭ 17 (-72.13%)
Mutual labels:  data-binding
Observable Slim
Observable Slim is a singleton that utilizes ES6 Proxies to observe changes made to an object and any nested children of that object. It is intended to assist with state management and one-way data binding.
Stars: ✭ 178 (+191.8%)
Mutual labels:  data-binding
Android Submit Credit Card Flow
💳 implementation of credit card form in material design
Stars: ✭ 628 (+929.51%)
Mutual labels:  data-binding
Knockout
Knockout makes it easier to create rich, responsive UIs with JavaScript
Stars: ✭ 10,122 (+16493.44%)
Mutual labels:  data-binding
nytclient-android
This sample app is created to demonstrate the usage of Android Architecture Components with MVVM architecture
Stars: ✭ 24 (-60.66%)
Mutual labels:  data-binding
Nestedlink
Callback-free React forms with painless validation.
Stars: ✭ 194 (+218.03%)
Mutual labels:  data-binding
Tldroid
man pages on the go, written in Kotlin!
Stars: ✭ 120 (+96.72%)
Mutual labels:  data-binding

RxBinding

CI Status Version License Platform swift

RxBinding provides ~>, <~> and ~ operators for data binding using RxSwift, to replace the bind(to:) and disposed(by:) method in RxSwift.

RxBinding is inspired by the following operators.

Documentation

RxBinding is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'RxBinding'

With @_expoerted import, the operators can be used in the all file of the project.

@_exported import RxBinding

Usage of ~>

The type of text is Observable<String?> and the type of label.rx.text is Binder<String?>. RxSwfit provides the following method for the one way data binding between them.

viewModel.text.bind(to: label.rx.text).disposed(by: disposeBag)

With the operators ~> (bind(to:)) and ~ (disposed(by:)) in RxBinding, we can bind with the following simple code.

viewModel.text ~> label.rx.text ~ disposeBag

Bind an observable object to multiple binders.

viewModel.text ~> [label1, label2].map { $0.rx.text } ~ disposeBag

Usage of <~>

The type of text is BehaviorRelay<String?> and the type of textFeild.rx.text is ControlProperty<String?>. To apply the two way data binding between them, we need the following code by RxSwift.

viewModel.text.bind(to: textFeild.rx.text).disposed(by: disposeBag)
textFeild.rx.text.bind(to: viewModel.text).disposed(by: disposeBag)

With the <~>, a simple two way bind operator, and ~ (disposed(by:)) in RxBinding, we can do the same thing with the following simple code.

viewModel.text <~> textFeild.rx.text ~ disposeBag

Multiple Bindings

RxBinding supports using a single disposeBag for multiple binding operators like this:

disposeBag ~ [
    viewModel.text <~> textFeild.rx.text,
    viewModel.uppercaseText ~> label.rx.text,
    viewModel.charactersCount ~> [characterCountLabel1, characterCountLabel2].map { $0.rx.text }
]

or this:

viewModel.text <~> textFeild.rx.text ~
viewModel.uppercaseText ~> label.rx.text ~
viewModel.charactersCount ~> [characterCountLabel1, characterCountLabel2].map { $0.rx.text }
  ~ disposeBag

RxCocoa

RxBinding also supports Driver and Signal of the RxCocoa module. You can use ~> operator to replace the drive() and emit(to:) method.

NEED YOUR HELP

I am considering how to remove the operator ~ after the Binder or the ControlEvent property.

viewModel.text ~> label.rx.text

If anyone has a good idea about this, please contact me here #1 or create a PR. Thanks.

The operator ~> is equal to bind(to:).

viewModel.text ~> label.rx.text

is euqals to

viewModel.text.bind(to: label.rx.text)

I mean how to combine the method disposed(by:) into the operator ~>.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

lm2343635, [email protected]

License

RxBinding is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].