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
Post a Comment