README.md in bubble-wrap-0.2.1 vs README.md in bubble-wrap-0.3.0
- old
+ new
@@ -12,10 +12,12 @@
1. Edit the Rakefile of your RubyMotion project and add the following require line.
```ruby
require 'bubble-wrap'
```
+Note: **DON'T** use `app.files =` in your Rakefile to set up your files once you've required BubbleWrap.
+Make sure to append onto the array or use `+=`.
2. Now, you can use BubbleWrap extension in your app:
```ruby
class AppDelegate
@@ -63,40 +65,48 @@
## JSON
`BubbleWrap::JSON` wraps `NSJSONSerialization` available in iOS5 and offers the same API as Ruby's JSON std lib.
-## Kernel
+## Device
-A collection of useful methods used often in my RubyMotion apps.
+A collection of useful methods about the current device:
Examples:
```ruby
-> iphone?
+> Device.iphone?
# true
-> ipad?
+> Device.ipad?
# false
-> orientation
+> Device.orientation
# :portrait
-> simulator?
+> Device.simulator?
# true
-> documents_path
-# "/Users/mattetti/Library/Application Support/iPhone Simulator/5.0/Applications/EEC6454E-1816-451E-BB9A-EE18222E1A8F/Documents"
```
## App
-A module allowing developers to store global states and also provides a
-persistence layer.
+A module with useful methods related to the running application
+```ruby
+> App.documents_path
+# "/Users/mattetti/Library/Application Support/iPhone Simulator/5.0/Applications/EEC6454E-1816-451E-BB9A-EE18222E1A8F/Documents"
+> App.resources_path
+# "/Users/mattetti/Library/Application Support/iPhone Simulator/5.0/Applications/EEC6454E-1816-451E-BB9A-EE18222E1A8F/testSuite_spec.app"
+> App.name
+# "testSuite"
+> App.identifier
+# "io.bubblewrap.testSuite"
+```
+
## NSUserDefaults
Helper methods added to the class repsonsible for user preferences.
## NSIndexPath
-Helper methods added to give `NSIndexPath` a bit more or a Ruby
+Helper methods added to give `NSIndexPath` a bit more of a Ruby
interface.
## Gestures
Extra methods on `UIView` for working with gesture recognizers. A gesture recognizer can be added using a normal Ruby block, like so:
@@ -127,22 +137,23 @@
Helper methods to give NSNotificationCenter a Ruby-like interface:
```ruby
def viewWillAppear(animated)
- notification_center.observe self, UIApplicationWillEnterForegroundNotification do
+ @foreground_observer = notification_center.observe UIApplicationWillEnterForegroundNotification do |notification|
loadAndRefresh
end
- notification_center.observe self, ReloadNotification do
+ @reload_observer notification_center.observe ReloadNotification do |notification|
loadAndRefresh
end
end
def viewWillDisappear(animated)
- notification_center.unobserve self
+ notification_center.unobserve @foreground_observer
+ notification_center.unobserve @reload_observer
end
def reload
notification_center.post ReloadNotification
end
-```
\ No newline at end of file
+```