Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Access current type by calling Self instead of manually calling <current type>.self
protocol TypeReflectable {
var `Self`: Self.Type { get }
static var `Self`: Self.Type { get }
}
extension TypeReflectable {
var `Self`: Self.Type {
return type(of: self)
}
static var `Self`: Self.Type {
return self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.