Here is my code:
protocol base{}
protocol sub: base{}
protocol SomeProtocol{
var a: base{get}
}
struct SomeStruct: SomeProtocol{
// var a: base
var a: sub
}
when I use var a: sub
in Struct, I get an error:
Type 'SomeStruct' does not conform to protocol 'SomeProtocol'
I'm wondering var a: sub
should conform to base protocol, but why Swift cannot write like this? Is there any better plan?