rubymotion/BubbleWrap — pull request #226 by ryansobol (2013-05-04 18:38:52+00:00)
Title: Refactor BW::UIBarButtonItem module to a class

So, I've come to a realization. I think that changing `BW::UIBarButtonItem` to a subclass (rather than a factory module) is a better architecture pattern for BubbleWrap's future.

My original design for `BW::UIBarButtonItem` was a factory module because:

1. I was concerned that overloading `+init` on `UIBarButtonItem` would be dangerous.

2. Someday, I wanted to explore the option of polluting `UIBarButtonItem` itself.

3. I disliked the thought of typing `BubbleWrap::` all the time.

However, I've since changed my mind while implementing `BW::UIAlertView`:

1. lrz reminded me that overloading `.new` on Cocoa Touch classes is quite safe.

2. I've given up on my dream to pollute Cocoa Touch classes because of the potential compatibility issues it creates with other 3rd party libraries.

3. I've actually grown found of seeing `BW::` in my code. :)

---

This patch has **no behavior changes** and **maintains backward-compatibility**. The only changes are:

- The constructor methods now return instances of `BW::UIBarButtonItem` which is a subclass of `UIBarButtonItem`.

- The `.new` constructor method replaces `.build`. Calling `.build` forwards to `.new` and outputs a deprecation warning to `NSLog`.