{"id":19685895,"url":"https://github.com/rxswiftcommunity/rxbinding","last_synced_at":"2025-04-29T06:31:02.553Z","repository":{"id":55011540,"uuid":"180917781","full_name":"RxSwiftCommunity/RxBinding","owner":"RxSwiftCommunity","description":"Simple data binding operators ~\u003e and \u003c~\u003e for RxSwift.","archived":false,"fork":false,"pushed_at":"2021-01-15T12:36:25.000Z","size":78,"stargazers_count":62,"open_issues_count":1,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-19T22:36:34.675Z","etag":null,"topics":["data-binding","operators","rswift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RxSwiftCommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-12T02:48:20.000Z","updated_at":"2024-09-11T15:26:15.000Z","dependencies_parsed_at":"2022-08-14T09:00:54.493Z","dependency_job_id":null,"html_url":"https://github.com/RxSwiftCommunity/RxBinding","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxBinding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxBinding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxBinding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxBinding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RxSwiftCommunity","download_url":"https://codeload.github.com/RxSwiftCommunity/RxBinding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251450656,"owners_count":21591407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-binding","operators","rswift"],"created_at":"2024-11-11T18:24:37.381Z","updated_at":"2025-04-29T06:31:02.291Z","avatar_url":"https://github.com/RxSwiftCommunity.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RxBinding\n\n[![CI Status](https://img.shields.io/travis/RxSwiftCommunity/RxBinding.svg?style=flat)](https://travis-ci.org/RxSwiftCommunity/RxBinding)\n[![Version](https://img.shields.io/cocoapods/v/RxBinding.svg?style=flat)](https://cocoapods.org/pods/RxBinding)\n[![License](https://img.shields.io/cocoapods/l/RxBinding.svg?style=flat)](https://cocoapods.org/pods/RxBinding)\n[![Platform](https://img.shields.io/cocoapods/p/RxBinding.svg?style=flat)](https://cocoapods.org/pods/RxBinding)\n[![swift](https://img.shields.io/badge/swift-5.0-orange.svg)](https://github.com/RxSwiftCommunity/RxBinding/releases)\n\nRxBinding provides `~\u003e`, `\u003c~\u003e` and `~` operators for data binding using RxSwift, to replace the `bind(to:)` and `disposed(by:)` method in RxSwift.\n\nRxBinding is inspired by the following operators.\n\n- The `\u003c-\u003e` operator in RxBiBinding (https://github.com/RxSwiftCommunity/RxBiBinding)\n- The `\u003c~` operator in ReactiveCocoa (https://github.com/ReactiveCocoa/ReactiveCocoa)\n\n## Documentation\n\nRxBinding is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'RxBinding'\n```\n\nWith `@_expoerted import`, the operators can be used in the all file of the project.\n\n```Swift\n@_exported import RxBinding\n```\n\n#### Usage of `~\u003e`\n\nThe type of `text` is `Observable\u003cString?\u003e` and the type of `label.rx.text` is `Binder\u003cString?\u003e`.\nRxSwfit provides the following method for the one way data binding between them.\n\n```Swift\nviewModel.text.bind(to: label.rx.text).disposed(by: disposeBag)\n```\n\nWith the operators `~\u003e` (`bind(to:)`) and `~` (`disposed(by:)`) in RxBinding, we can bind with the following simple code.\n\n```Swift\nviewModel.text ~\u003e label.rx.text ~ disposeBag\n```\n\nBind an observable object to multiple binders.\n\n```Swift\nviewModel.text ~\u003e [label1, label2].map { $0.rx.text } ~ disposeBag\n```\n\n#### Usage of `\u003c~\u003e`\n\nThe type of `text` is `BehaviorRelay\u003cString?\u003e` and the type of `textFeild.rx.text` is `ControlProperty\u003cString?\u003e`.\nTo apply the two way data binding between them, we need the following code by RxSwift.\n\n```Swift\nviewModel.text.bind(to: textFeild.rx.text).disposed(by: disposeBag)\ntextFeild.rx.text.bind(to: viewModel.text).disposed(by: disposeBag)\n```\n\nWith the `\u003c~\u003e`, a simple two way bind operator, and `~` (`disposed(by:)`) in RxBinding, we can do the same thing with the following simple code.\n\n```Swift\nviewModel.text \u003c~\u003e textFeild.rx.text ~ disposeBag\n```\n\n#### Multiple Bindings\n\nRxBinding supports using a single `disposeBag` for multiple binding operators like this:\n\n```Swift\ndisposeBag ~ [\n    viewModel.text \u003c~\u003e textFeild.rx.text,\n    viewModel.uppercaseText ~\u003e label.rx.text,\n    viewModel.charactersCount ~\u003e [characterCountLabel1, characterCountLabel2].map { $0.rx.text }\n]\n```\nor this:\n\n```Swift\nviewModel.text \u003c~\u003e textFeild.rx.text ~\nviewModel.uppercaseText ~\u003e label.rx.text ~\nviewModel.charactersCount ~\u003e [characterCountLabel1, characterCountLabel2].map { $0.rx.text }\n  ~ disposeBag\n```\n\n## RxCocoa\n\nRxBinding also supports `Driver` and `Signal` of the RxCocoa module.\nYou can use `~\u003e` operator to replace the `drive()` and `emit(to:)` method.\n\n## NEED YOUR HELP\n\n**I am considering how to remove the operator ~ after the Binder or the ControlEvent property.**\n\n```Swift\nviewModel.text ~\u003e label.rx.text\n```\n\nIf anyone has a good idea about this, please contact me here https://github.com/RxSwiftCommunity/RxBinding/issues/1 or create a PR.\nThanks.\n\nThe operator `~\u003e` is equal to `bind(to:)`.\n\n```swift \nviewModel.text ~\u003e label.rx.text\n``` \nis euqals to\n```swift \nviewModel.text.bind(to: label.rx.text)\n````\n\nI mean how to combine the method `disposed(by:)` into the operator `~\u003e`.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Author\n\nlm2343635, lm2343635@126.com\n\n## License\n\nRxBinding is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxswiftcommunity%2Frxbinding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frxswiftcommunity%2Frxbinding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxswiftcommunity%2Frxbinding/lists"}