This PR enables developers to use a single API when dealing with stack views. OAStackViewProxy wraps a UIStackView on iOS 9 and an OAStackVew on any older OS version.
Each method call takes advantage of Swift's build in #avaiable API to determine which stack view to use under the hood. Each property is exposed on the proxy with OAStackView's enum types. The proxy also takes advantage of Swift's didSet to update properties on the stack views.
I updated the example app to use the proxy over an OAStackView directly. This means we don't have to modify the tests because we are already using the class. However, this is only the case on iOS 8. Running the tests on iOS 9 will just use a wrapped UIStackView.
One caveat to this approach is that the target application needs to import <OAStackView/OAStackView-Swift.h> to use the proxy. I also had to enable CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES to successfully build the module. Perhaps someone with more experience in building frameworks can lend a hand here.
Note: Storyboards are not supported.
This PR was inspired by @natanrolnik's work on #32.
Wouldn't this compromise iOS 7 compatibility? I mean, CocoaPods requires frameworks and hence iOS 8+ deployment target for dependencies with Swift code.
This PR enables developers to use a single API when dealing with stack views.
OAStackViewProxy
wraps aUIStackView
on iOS 9 and anOAStackVew
on any older OS version.Each method call takes advantage of Swift's build in
#avaiable
API to determine which stack view to use under the hood. Each property is exposed on the proxy withOAStackView
's enum types. The proxy also takes advantage of Swift'sdidSet
to update properties on the stack views.I updated the example app to use the proxy over an
OAStackView
directly. This means we don't have to modify the tests because we are already using the class. However, this is only the case on iOS 8. Running the tests on iOS 9 will just use a wrappedUIStackView
.One caveat to this approach is that the target application needs to import
<OAStackView/OAStackView-Swift.h>
to use the proxy. I also had to enableCLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
to successfully build the module. Perhaps someone with more experience in building frameworks can lend a hand here.Note: Storyboards are not supported.
This PR was inspired by @natanrolnik's work on #32.