How to derive one class from two different classes in Swift based on API level?

Viewed 221

I want to use a library with a class SwipeTableViewCell (derives from UITableViewCell), but it only supports iOS 9, so I want to derive from that class if possible, but from the normal UITableViewCell class if the app is running below 9.0.

This is the best I could come up with (not working):

@available(iOS, obsoleted: 9.0)
class MyTableViewCell : UITableViewCell {
}

@available(iOS 9.0, *)
class MyTableViewCell : SwipeTableViewCell {
}

Then I try to derive from that class:

class SomeOtherTableViewCell : MyTableViewCell {
}

Xcode gives me the following error and links to the two class definitions above:

SomeOtherTableViewCell.swift:34:31: 'MyTableViewCell' is ambiguous for type lookup in this context
Found this candidate
Found this candidate

What's the cool way in Swift to conditionally derive from two different classes depending on API level?

1 Answers
Related