Array of protocol type

前端 未结 3 1413
感动是毒
感动是毒 2021-02-15 11:24

I have checked all answers about this problem on stackoverflow, but still can not figure out how to fix this. My model looks like this

protocol Commandable: Eq         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-15 11:42

    I believe the problem here is that the equatable protocol has self requirements. So you can solve you problem by removing equatable protocol from your Commandable protocol and make your your structs equatable instead. This will of course limit your protocol but maybe it is a trade-off that is reasonable?

提交回复
热议问题