[swift-users] Are typealiases within protocols supposed to be visible from conforming types?

Karl razielim at gmail.com
Thu Aug 4 00:55:50 CDT 2016


Straightforward question - Are typealiases within protocols supposed to be visible from conforming types?

For example:

> protocol MyProto {
> 	
> 	typealias ComplexFunctionType = (_ paramOne: (Int, Bool?), _ paramTwo: (Bool, String?, String)) throws -> (Array<Int>, Float)?
> 
> 	func doSomething(callback: ComplexFunctionType)
> }
> 
> struct Conformist : MyProto {
> 	
> 	// do I really have to write that whole thing out again?
> 	// or copy-paste and sync changes for all conforming types?
> }

Currently they are not visible from the conforming type (so you would need to duplicate the definition of ComplexFunctionType), but I’m not sure if that's a bug or feature.

Karl


More information about the swift-users mailing list