Instance | Type |
---|---|
”Hello World” | String |
String.self or type(of:"Hello") | String.Type |
- A metatype is simply a type with
.Type
appended to it, e.g.String.Type
- A metatype instance can be specified by appending
.self
to a type, e.g.String.self
- To get a metatype instance at runtime, simply pass an instance to
type(of:)
- Metatypes allow access to properties, methods, and initializers belonging to the type.