I'm struggling with protocols in Swift. I have defined a protocol like this:
protocol AProtocol {
var property : BProtocol {get set}
}
And I would like to conform to AProtocol
in a class with a property that also conform to another protocol. I've tried in these two ways:
class AClass: AProtocol {
var property = BClass()
}
and:
class AClass: AProtocol {
var property: BProtocol & MyBClassType = BProtocol()
}
but none of them seems to work (BClass itself confirm to BProtocol) This issue is a bit difficult to explain, I hope it was clear.
Is it a limitation of the Swift language? Do you know a work around to this?