nsomar / OAStackView

Porting UIStackView to iOS 7+
MIT License
2.14k stars 200 forks source link

UIStackView and OAStackView as a single class #68

Open Katafalkas opened 8 years ago

Katafalkas commented 8 years ago

Hey. This is not bug nor it is an issue. Rather a question someone in this project could answer.

Is there a way of creating a subclass that would use UIStackView or OAStackView as a superclass depending on ios version ?

something like that ? (this does not work)

if #available(iOS 9.0, *) {
    class StackView: UIStackView {}
} else {
    class StackView: OAStackView {}
}

Any ideas of achieving something similar ?

harlanhaskins commented 8 years ago

Swift's type system won't let you do this. The compiler can't guarantee that UIStackView and OAStackView are isomorphic, and there's no facility for ensuring it anyway.

paleozogt commented 7 years ago

Is this a dupe of #2?