0

There I have two Protocol:

1.

protocol BaseProtocol {
    associatedtype T: Identifiable<String>
    
    var array: [T]
}
protocol AnotherProtocol: Identifiable<String> {
   var id: String
}

Then I try to do this, but not woking, said "does not conform to protocol"

struct MyStruct: BaseProtocol {
   //no working
   var array: [any AnotherProtocol]
   //or:
   typealias T = any AnotherProtocol // Same, not working

}

Is that impossible to do that?

Tyler
  • 1
  • 1
  • 1
    See [this](https://stackoverflow.com/q/33112559/5133585). Basically the compiler is afraid that you might declare static requirements in `AnotherProtocol`. – Sweeper Mar 16 '23 at 07:59
  • @Sweeper Thanks! I think that's the reason that not allow me to do that. Anyway, I already use different way to avoid this situation. – Tyler Mar 16 '23 at 09:02

0 Answers0