I have a quick code:
import Foundation protocol ParentProtocol { //stuff } protocol ChildProtocol:ParentProtocol { //additional stuff } protocol FooProtocol { var variable:ParentProtocol? { get } } class Foo:FooProtocol { var variable:ChildProtocol? }
I have a compiler error: Type 'Foo' does not conform to protocol 'FooProtocol'
I know that according to FooProtocol type of the variable should be ParentProtocol . On the other hand, ChildProtocol inherits from ParentProtocol , so it is also ParentProtocol
Is there any solution for using protocol inheritance in this way?
source share