Swift Keywords
Welcome to Swift Tutorial. In this tutorial, we will learn about the reserved keywords in Swift programming.
Swift keywords are the words reserved for a purpose.
They cannot be used for variable names constants or any other identifiers.
There are four types of keywords in Swift based on the location of their usage in a swift program.
- Keywords in Declarations
- Keywords in Statements
- Keywords in Expressions and Types
- Keywords in Specific Contexts
Swift Keywords used in Declarations
Class | deinit | enum | extension |
func | import | Init | internal |
Let | operator | private | protocol |
public | static | struct | subscript |
typealias | var |
Swift Keywords used in Statements
Swift Keywords used in Expressions and Types
as | dynamicType | false | is |
nil | self | Self | super |
true | _COLUMN_ | _FILE_ | _FUNCTION_ |
_LINE_ |
Swift Keywords used in Specific Contexts
associativity | convenience | dynamic | didSet |
final | get | infix | inout |
lazy | left | mutating | none |
nonmutating | optional | override | postfix |
precedence | prefix | Protocol | required |
right | set | Type | unowned |
weak | willSet |
We shall go through all these keywords in this series of Swift Tutorial and explain in detail with examples when necessary.