swift - List of supported protocols -


how can set supported protocols generic class? have base protocol

public protocol responseexpectable {     associatedtype responsetype: mappable } 

and childs

public protocol dtoresponseexpectable: responseexpectable {} public protocol dtolistresponseexpectable: dtoresponseexpectable { associatedtype responsetype: responselistdto } public protocol arraydtoresponseexpectable: responseexpectable {} public protocol stringdtoresponseexpectable: responseexpectable {} 

and have generic class

class basedtopresentcontroller<requestdto: responseexpectable>: uiviewcontroller 

how can different implementation diferent childs protocols? ty cast if let dto = dto as? dtoresponseexpectable. give error

  • protocol 'dtoresponseexpectable' can used generic constraint because has self or associated type requirements


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -