I'm wondering if it's possible to achieve such a thing.
I have a Playground like this:
protocol Foo {
func testPrint()
}
extension Foo {
func testPrint() {
print("Protocol extension call")
}
}
struct Bar: Foo {
func testPrint() {
// Calling self or super go call default implementation
self.testPrint()
print("Call from struct")
}
}
let sth = Bar()
sth.testPrint()
I can provide a default implementation in extension
but what if Bar
needs everything that is in default implementation plus additional things?
It's somehow similar to calling super.
methods in class
es to fulfill requirement of implementing every property etc. but I see no possibility to achieve the same with structs
.