https://github.com/khuong291/Binder
🦁"Hello World" <-> [🏷, 🏷, 🏷, 🏷]
https://github.com/khuong291/Binder
binder binding reactive-programming reactiveui ui
Last synced: about 1 year ago
JSON representation
🦁"Hello World" <-> [🏷, 🏷, 🏷, 🏷]
- Host: GitHub
- URL: https://github.com/khuong291/Binder
- Owner: khuong291
- License: mit
- Created: 2018-02-07T13:07:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-15T08:44:54.000Z (almost 8 years ago)
- Last Synced: 2025-03-04T18:44:52.402Z (about 1 year ago)
- Topics: binder, binding, reactive-programming, reactiveui, ui
- Language: Swift
- Homepage:
- Size: 197 KB
- Stars: 34
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](http://cocoapods.org/pods/Binder)
[](https://github.com/Carthage/Carthage)
[](https://developer.apple.com/swift/)
[](http://cocoapods.org/pods/Binder)
[](http://cocoapods.org/pods/Binder)
*A lightweight data binding for components on iOS*
## About
A lightweight data binding for components on iOS, easy to use and does not have retain cycle.

## Contributing
1. Fork project
2. Checkout **master** branch
3. Create **Feature** branch off of the **master** branch
4. Create awesome feature/enhancement/bug-fix
5. Optionally create *Issue* to discuss feature
6. Submit pull request from your **Feature** branch to Binder's **master** branch
## Installation
### [Cocoapods](http://cocoapods.org)
```ruby
use_frameworks!
pod 'Binder'
```
### [Carthage](https://github.com/Carthage/Carthage)
Add Binder to you `Cartfile`
```sh
github "khuong291/Binder"
```
Install using
```sh
carthage update --platform ios
```
### Manually
1. Download and drop ```/Binder``` folder in your project.
2. You're done!
## Getting started
### Create a Binder object:
```swift
private let colorBinder: Binder = Binder(value: .white, type: .backgroundColor)
private let textBinder: Binder = Binder(value: "Hello", type: .text)
```
### You can bind many components as you want:
```swift
colorBinder <-> [view1, view2, view3, view4]
textBinder <-> label1 <-> label2 <-> label3 <-> label4
```
### Change the binder value:
```swit
colorBinder.value = .green
textBinder.value = "Green Color"
```
### If you want to avoid retain cycle, you should remove binder objects:
```swift
deinit {
colorBinder.remove()
textBinder.remove()
}
```
### And that's it ;)
## Requirements
* iOS 9.0+
* Xcode 8.0+
* Swift 3.0+
## Author
[Khuong Pham](https://khuong291.github.io/home/)
## License
Binder is released under the MIT license.
See LICENSE for details.