[swift-evolution] [Draft] Allow declaration of abstract functions and properties on classes

Pierre Monod-Broca pierre at monod-broca.fr
Fri Feb 26 07:52:42 CST 2016


Well not exactly, if you want the same behaviors in subclasses of UIViewController and UITableViewController :
 - with protocols + extensions, you write in once and apply it to each of your subclasses
 - with abstract classes you have to write 2 abstract classes, one for direct UIViewController subclasses, one for UITableViewController subclasses


> Le 26 févr. 2016 à 12:07, Alex Hoppen via swift-evolution <swift-evolution at swift.org> a écrit :
> 
>> You're right that this is currently somewhat convoluted (and someone else mentioned that the extension members may not override the inherited ones, which is obviously another problem). But I think protocols are actually pretty close to what you want already, and we're better off extending them to cover abstract class use cases than extending classes.
> 
> I am curious to see a way that protocols can override existing methods, since the protocols are always at the top of the inheritance chain and putting them anywhere else makes them abstract classes by definition.
> 
> – Alex
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list