Skip to content

Instantly share code, notes, and snippets.

@johanhar
Created March 23, 2016 10:02
Show Gist options
  • Save johanhar/33823c396e8bfa697fb5 to your computer and use it in GitHub Desktop.
Save johanhar/33823c396e8bfa697fb5 to your computer and use it in GitHub Desktop.
Meta types
func getType<T>(type: T.Type) -> T.Type {
return type.self
}
class Foo {
required init() { }
}
let MyType = getType(Foo)
let myFoo = MyType.init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment