Hm, I just searched the forum for this topic and I found some corresponding threads:
I also found a topic to the override thing:
It seems, that there is no review or these pitches, but obviously the language now supports the way of default implementations via adding an extension.
In my opinion, this way is very confusing. An extension is described in the documentation as: "Extensions add new functionality to an existing class, structure, enumeration, or protocol type"
Bringing a default implementation is no added functionality. It is an implementation. My understand of extending a protocol would mean, that I add a new method, that also needs to be implemented by all classes or structs, that uses this protocol. This way can be necessery, if I don't have access to the source code, that is defining this protocol.
Interestingly, this is at least not possible!
extension HandlerProtocol {
func newMethod()
}
This brings the error "Expected '{' in body of function declaration". So extending a protocol
is not possible in Swift. Or do I miss sth.?
So in my opinion, this kind of default implementations should be made with a keword like implement protocol
(or sth. like this), not with an extension
.