I have swift code:
protocol ParentProtocol {
// stuff
}
protocol ChildProtocol: ParentProtocol {
// additional stuff
}
protocol FooProtocol {
var variable: ParentProtocol? { get }
}
class Foo:FooProtocol {
var variable: ChildProtocol?
}
I've got compiler error:
Type 'Foo' does not conform to protocol 'FooProtocol'
I know, that according to the FooProtocol, variable type must be ParentProtocol type. On the other hand ChildProtocol inherits from ParentProtocol, so it also is a ParentProtocol
Is there any solution to use protocol inheritance in that way?