README.md in motion_bindable-0.1.0 vs README.md in motion_bindable-0.1.1
- old
+ new
@@ -1,7 +1,10 @@
# Motion Bindable
+[![Build Status](https://travis-ci.org/nathankot/motion-bindable.png?branch=master)](https://travis-ci.org/nathankot/motion-bindable)
+[![Code Climate](https://codeclimate.com/github/nathankot/motion-bindable.png)](https://codeclimate.com/github/nathankot/motion-bindable)
+
A simple data binding library for RubyMotion.
## Installation
Add this line to your application's Gemfile:
@@ -74,17 +77,51 @@
end
```
When `@name_field.text` or `@address_field.text` changes, so will your model!
-### Strategies
+### Refresh
+To refresh the values on your bindable object use this:
+
+```ruby
+@bindable.refresh
+```
+
+Some strategies only make an update when a `#refresh` is called. See the
+_Frequency_ column in the table below.
+
+### Custom Strategies
+
The above example uses the `MotionBindable::Strategies::UITextField`.
which comes with MotionBindable. Take a look in
`lib/motion_bindable/strategies` for the available defaults. You can implement
your own strategies by extending `MotionBindable::Strategy` like so:
-**TODO**
+```ruby
+class CustomBindableStrategy < MotionBindable::Strategy
+
+ def on_bind
+ # This runs once when the object is bound.
+ end
+
+ def refresh
+ # This runs when the object is bound, and each time `@bindable.refresh`
+ # is called.
+ end
+
+end
+```
+
+### Defaults Strategies
+
+The following strategies come with motion-bindable and are setup when
+`MotionBindable::Strategies.use` is called.
+
+| Name | Object Candidates | Direction | Frequency |
+| ----------------------------------------- | ----------------- | --------- | ---------- |
+| `MotionBindable::Strategies::UITextField` | Any `UITextField` | Two-way | On Change |
+| `MotionBindable::Strategies::Proc` | Any `Proc` | One-way | On Refresh |
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)