OAStackView icon indicating copy to clipboard operation
OAStackView copied to clipboard

UIStackView and OAStackView as a single class

Open Katafalkas opened this issue 10 years ago • 2 comments

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 ?

Katafalkas avatar Nov 27 '15 09:11 Katafalkas

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.

harlanhaskins avatar Nov 27 '15 17:11 harlanhaskins

Is this a dupe of #2?

paleozogt avatar Jan 19 '17 15:01 paleozogt