What does `someVar` or single quote in fast mean

I came across this in the Apple documentation, as well as in the NSObject swift class:

 func `self`() -> Self! func conformsToProtocol(_ `aProtocol`: Protocol) -> Bool 

I searched on the Internet, but I could not find what the syntax means in this context. Does anyone know what that means or what he called.

Thanks to everyone.

+1
source share
1 answer

From Swift docs :

To use a reserved word as an identifier, put the back side (`) before and after. For example, a class is not a valid identifier, but `class` is valid. Backlinks are not considered part of the identifier; `x` and x have the same meaning.

 `` 

Called backticks.

In your example, it seems that the self keyword is escaped so that the function can be called "self".

+2
source

Source: https://habr.com/ru/post/1258554/


All Articles