README.md in motion_bindable-0.2.5 vs README.md in motion_bindable-0.3.0
- old
+ new
@@ -3,10 +3,15 @@
[![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 two-way data binding library for RubyMotion.
+## NOTICE
+
+Version `0.3.0` introduces breaking changes and deprecations. If you're upgrading, please check the [release
+notes](nathankot/motion-bindable/releases/tag/v0.3.0).
+
## Installation
Add this line to your application's Gemfile:
```ruby
@@ -22,11 +27,11 @@
If you want to use the default strategies that come with MotionBindable add
this to your `app_delegate.rb`:
``` ruby
def application(application, didFinishLaunchingWithOptions: launch_options)
- MotionBindable::Strategies.use
+ MotionBindable::Strategies.apply
true
end
```
## Terminology
@@ -73,17 +78,25 @@
@address_field = UITextField.alloc.initWithFrame [[110, 100], [100, 26]]
@address_field.placeholder = "Address"
view.addSubview @address_field
@item = Item.new
+ end
+
+ def viewWillAppear(animated)
@item.bind_attributes({
name: @name_field,
location: {
address: @address_field
}
})
end
+
+ # Recommended: Clean everything up when the view leaves
+ def viewWillDisappear(animated)
+ @item.unbind_all
+ end
end
```
When `@name_field.text` or `@address_field.text` changes, so will your model!
@@ -99,12 +112,12 @@
The following strategies come with motion-bindable and are setup when
`MotionBindable::Strategies.apply` is called.
| Name | Object Candidates | Direction |
| ----------------------------------------- | ----------------- | ------------------- |
-| `MotionBindable::Strategies::UITextField` | Any `UITextField` | Bound >-< Attribute |
-| `MotionBindable::Strategies::Proc` | Any `Proc` | Bound >-- Attribute |
-| `MotionBindable::Strategies::UILabel` | Any `UILabel` | Bound --< Attribute |
+| `MotionBindable::Strategies::UITextField` | Any `UITextField` | Bound <-> Attribute |
+| `MotionBindable::Strategies::Proc` | Any `Proc` | Bound --> Attribute |
+| `MotionBindable::Strategies::UILabel` | Any `UILabel` | Bound <-- Attribute |
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)