Wagner, the `extension` of `protocol` is never dynamic. It is `fail safe`. It means if you don't implement something, the compiler will use the implementation in the `protocol extension`. As in swift, struct and enum can also conform protocols.
If you want the other way, you should do it in a base class, not in a protocol extension. Zhaoxin On Tue, Jan 24, 2017 at 4:32 AM, Wagner Truppel via swift-users < swift-users@swift.org> wrote: > On 23 Jan 2017, at 19:56, Slava Pestov <spes...@apple.com> wrote: > > class B: A { > > var item: String { // subclass specialises 'item' by "overriding" the > protocol extension implementation > > > This is the problem. You’re not overriding the protocol extension version, > you’re just shadowing it for the purposes of compile-time name lookup. Note > that if you add the ‘override’ keyword here, the compiler complains because > there’s nothing in the base class to override. > > > Yes, that's why I wrote overriding in quotes and also why I tried to use > the word specialise in place of override. My beef is not really here; this > really was just a preamble. My issue is with the fact that adding the > declaration to the protocol doesn't solve the problem despite the fact that > the property is then supposed to be dynamically dispatched but isn't. > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users > >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users