GithubHelp home page GithubHelp logo

khuong291 / binder Goto Github PK

View Code? Open in Web Editor NEW
34.0 5.0 1.0 202 KB

๐Ÿฆ"Hello World" <-> [๐Ÿท, ๐Ÿท, ๐Ÿท, ๐Ÿท]

License: MIT License

Objective-C 3.59% Swift 90.42% Ruby 5.98%
binding binder ui reactive-programming reactiveui

binder's Introduction

Version Carthage compatible Swift 4.0 Platform License

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

use_frameworks!

pod 'Binder'

Add Binder to you Cartfile

github "khuong291/Binder"

Install using

carthage update --platform ios

Manually

  1. Download and drop /Binder folder in your project.
  2. You're done!

Getting started

Create a Binder object:

private let colorBinder: Binder<UIColor, ViewBindingType> = Binder(value: .white, type: .backgroundColor)
private let textBinder: Binder<String, LabelBindingType> = Binder(value: "Hello", type: .text)

You can bind many components as you want:

colorBinder <-> [view1, view2, view3, view4]
textBinder <-> label1 <-> label2 <-> label3 <-> label4

Change the binder value:

colorBinder.value = .green
textBinder.value = "Green Color"

If you want to avoid retain cycle, you should remove binder objects:

deinit {
    colorBinder.remove()
    textBinder.remove()
}

And that's it ;)

Requirements

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 3.0+

Author

Khuong Pham

License

Binder is released under the MIT license.
See LICENSE for details.

binder's People

Contributors

khuong291 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

giangthai1294

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.