README.md in bubble-wrap-0.4.0 vs README.md in bubble-wrap-1.0.0.pre

- old
+ new

@@ -1,10 +1,11 @@ # BubbleWrap for RubyMotion A collection of (tested) helpers and wrappers used to wrap CocoaTouch code and provide more Ruby like APIs. [BubbleWrap website](http://bubblewrap.io) +[BubbleWrap mailing list](https://groups.google.com/forum/#!forum/bubblewrap) ## Installation ```ruby gem install bubble-wrap @@ -41,11 +42,11 @@ 2. Now, you can use BubbleWrap extension in your app: ```ruby class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) - puts "#{App.name} (#{documents_path})" + puts "#{App.name} (#{App.documents_path})" true end end ``` @@ -110,13 +111,13 @@ # false > Device.screen.width # 320 > Device.screen.height # 480 -> Device.screen.widthForOrientation(:landscape_left) +> Device.screen.width_for_orientation(:landscape_left) # 480 -> Device.screen.heightForOrientation(:landscape_left) +> Device.screen.height_for_orientation(:landscape_left) # 320 ``` ### Gestures @@ -161,11 +162,11 @@ def viewWillAppear(animated) @foreground_observer = notification_center.observe UIApplicationWillEnterForegroundNotification do |notification| loadAndRefresh end - @reload_observer notification_center.observe ReloadNotification do |notification| + @reload_observer = notification_center.observe ReloadNotification do |notification| loadAndRefresh end end def viewWillDisappear(animated) @@ -193,9 +194,36 @@ > App::Persistence['channels'] # application specific persistence storage # ['NBC', 'ABC', 'Fox', 'CBS', 'PBS'] > App::Persistence['channels'] = ['TF1', 'France 2', 'France 3'] # ['TF1', 'France 2', 'France 3'] ``` + +### Observers +**Since: > version 0.4** + +You can observe for object's changes and trigger blocks: + +``` ruby +class ExampleViewController < UIViewController + include BW::KVO + + def viewDidLoad + @label = "Initial state" + + observe(@label, "text") do |old_value, new_value| + puts "Hello from viewDidLoad!" + end + end + + def viewDidAppear(animated) + observe(@label, "text") do |old_value, new_value| + puts "Hello from viewDidAppear!" + end + end + +end +``` + ### String The Ruby `String` class was extended to add `#camelize` and `#underscore` methods.