README.md in bubble-wrap-1.8.0 vs README.md in bubble-wrap-1.9.0
- old
+ new
@@ -5,10 +5,11 @@
[BubbleWrap website](http://rubymotion.github.io/BubbleWrap/)
[BubbleWrap mailing list](https://groups.google.com/forum/#!forum/bubblewrap)
[](https://codeclimate.com/github/rubymotion/BubbleWrap)
[](https://travis-ci.org/rubymotion/BubbleWrap)
+[](http://badge.fury.io/rb/bubble-wrap)
[](https://gemnasium.com/rubymotion/BubbleWrap)
## Installation
```ruby
@@ -24,11 +25,11 @@
```
If you using Bundler:
```ruby
-gem "bubble-wrap", "~> 1.8.0"
+gem "bubble-wrap", "~> 1.9.0"
```
BubbleWrap is split into multiple modules so that you can easily choose which parts are included at compile-time.
If you wish to only include the `RSS Parser` wrapper:
@@ -77,10 +78,16 @@
```ruby
require 'bubble-wrap/sms'
```
+If you wish to only include the `Motion` (CoreMotion) wrapper:
+
+```ruby
+require 'bubble-wrap/motion'
+```
+
If you wish to only include the `NetworkIndicator` wrapper:
```ruby
require 'bubble-wrap/network-indicator'
```
@@ -296,10 +303,15 @@
### NSIndexPath
Helper methods added to give `NSIndexPath` a bit more of a Ruby
interface.
+```ruby
+index_path = table_view.indexPathForCell(cell)
+index_path + 1 # NSIndexPath for next cell in the same section
+=> #<NSIndexPath:0x120db8e0>
+```
### NSNotificationCenter
Helper methods to give NSNotificationCenter a Ruby-like interface:
@@ -374,11 +386,37 @@
end
end
```
+You can remove observers using `unobserve` method.
+**Since: > version 1.9.0**
+
+Optionally, multiple key paths can be passed to the `observer` method:
+
+``` ruby
+class ExampleViewController < UIViewController
+ include BW::KVO
+
+ def viewDidLoad
+ @label = UILabel.alloc.initWithFrame [[20,20],[280,44]]
+ @label.text = ""
+ view.addSubview @label
+
+ observe(@label, [:text, :textColor]) do |old_value, new_value, key_path|
+ puts "Hello from viewDidLoad for #{key_path}!"
+ end
+ end
+end
+```
+
+Also you can use `observe!` method to register observer that will immediately
+return initial value. Note that in this case only new value will be passed to
+the block.
+
+
### String
The Ruby `String` class was extended to add `#camelize` and
`#underscore` methods.
@@ -414,11 +452,15 @@
BW::Location.get(purpose: 'We need to use your GPS because...') do |result|
p "From Lat #{result[:from].latitude}, Long #{result[:from].longitude}"
p "To Lat #{result[:to].latitude}, Long #{result[:to].longitude}"
end
```
+*Note: `result[:from]` will return `nil` the first time location services are started.*
+The `:previous` key in the `BW::Location.get()` result hash will always return an array of zero or more additional `CLLocation` objects aside from the locations returned from the `:to` and `:from` hash keys. While in most scenarios this array will be empty, per [Apple's Documentation](https://developer.apple.com/library/IOs/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/index.html#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didUpdateLocations:) if there are deferred updates or multiple locations that arrived before they could be delivered, multiple locations will be returned in an order of oldest to newest.
+
+
```ruby
BW::Location.get_compass do |result|
p result[:magnetic_heading] # Heading towards magnetic north
p result[:true_heading] # Heading towards true north
p result[:accuracy] # Potential error between magnetic and true heading
@@ -1208,11 +1250,20 @@
> o.on(:november_5_1955) { puts "Another Ow!" }
> o.off(:november_5_1955)
=> nil
```
-# Suggestions?
+# Contributing
Do you have a suggestion for a specific wrapper? Feel free to open an
issue/ticket and tell us about what you are after. If you have a
wrapper/helper you are using and are thinking that others might enjoy,
-please send a pull request (with tests if possible).
+please send a pull request with tests. If you need help writing the tests,
+send the pull request anyways and we'll try to help you out with that.
+
+1. Create an issue in GitHub to make sure your PR will be accepted
+2. Fork the BubbleWrap repository
+3. Create your feature branch (`git checkout -b my-new-feature`)
+4. Commit your changes (`git commit -am 'Add some feature'`)
+5. Write tests for your changes and ensure they pass locally (`bundle exec rake spec && bundle exec rake spec osx=true`)
+6. Push to the branch (`git push origin my-new-feature`)
+7. Create new Pull Request