I\'ve wrote some functions (Swift 2.1, XCode 7.1.1):
public func test1(type: T.Type) -> T {
print(type.dynamicType)
return type.in
Coincidentally, this just came up on swift-evolution. The ability to omit .self
when the Type is the only argument, has been reported as a bug in Swift.
The relevant quote from Apple:
It's a bug.
.self
is supposed to be required everywhere. Unfortunately, we've had the bug for a while, so I'm not sure how much code we'd break by changing it. If we wanted to remove the requirement, that would be considered a language change and would have to go through the Swift Evolution Process.