ios - Swift: Generic Type conform Protocol -


i have problem generic type. want check if generic type conform protocol , after pass generic function. example have function:

func requestsignal<t:mappable>(target:api) -> signalproducer<[t], nserror>  

and want this:

func request<t>(target:api, withobjecttype type: t.type) {             if let mappabletype = type as? mappable.type {         let requestsignal: signalproducer<[?????], nserror>  = self.requestsignal(target) }  

but if tried pass t - doesn't conform mappable.

if pass mappabletype - not type

you can define t mappable, in first function.

func request<t: mappable> 

Comments