swift - Provide concrete type for Generic Protocol implementation -


is possible following:

protocol a: class {     typealias t: anyobject } extension {     func testa(a:self, _ t:t)->void{         print(a, t)     } } class b:a {     typealias t = string } 

in other words have protocol , want provide concrete type in class conforms it.

that should fine. issue code have there string not anyobject.

you need:

protocol a: class {     typealias t } extension {     func testa(a:self, _ t:t)->void{         print(a, t)     } } class b:a {     typealias t = string } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -