Refactor BW::UIBarButtonItem module to a class #226
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:+init
onUIBarButtonItem
would be dangerous.UIBarButtonItem
itself.BubbleWrap::
all the time.However, I've since changed my mind while implementing
BW::UIAlertView
:.new
on Cocoa Touch classes is quite safe.BW::
in my code. :)This patch has no behavior changes and maintains backward-compatibility. The only changes are:
BW::UIBarButtonItem
which is a subclass ofUIBarButtonItem
..new
constructor method replaces.build
. Calling.build
forwards to.new
and outputs a deprecation warning toNSLog
.