Böyle bir şeye ulaşmanın mümkün olup olmadığını merak ediyorum.Normal protokolden varsayılan protokol uygulaması çağrılıyor
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()
Ben extension
varsayılan bir uygulama sağlayabilir ama ne olursa Bar
varsayılan uygulanması artı ek şeylerde her şeyi gerekir:
Böyle bir Playground var?
super.
yönteminin, class
numaralı telefonlarda aranan her özelliği yerine getirme gereksinimini yerine getirmesine benzer. Ancak, structs
ile aynı sonucu elde etme olasılığını göremiyorum.
- sorun nedeniyle segmentasyon başarısız olmasıdır hata (7.0 GM ve 7.1 beta sürümünde test edilmiştir) – Antonio
Bu garip bir yapıdır sunduğunuz tion – cojoj
Her örnek yöntemi, ilk parametresi olan – Antonio