Postfix Self Expression
Postfix Self Expression
A postfix self
expression consists of an expression or the name of a type, immediately followed by .self
. It has the following forms:
-
expression.self
-
type.self
The first form evaluates to the value of the expression. For example, x.self
evaluates to x
.
The second form evaluates to the value of the type. Use this form to access a type as a value. For example, because SomeClass.self
evaluates to the SomeClass
type itself, you can pass it to a function or method that accepts a type-level argument.
GRAMMAR OF A SELF EXPRESSION
postfix-self-expression → postfix-expression.
self
https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Expressions.html#//apple_ref/swift/grammar/postfix-self-expression
我思故我在