Swift的关键字

在声明中使用关键字

let :声明一个常量

var  :声明一个变量

class  :声明一个类

static  :静态的

deinit  :反初始化方法?析构方法

init  :构造方法?初始化方法

enum  :枚举

extension  :扩展---给对象增加方法

func  :声明一个函数

import  :导入头文件

internal  :内部的

private  :私有的

public  :公开的

operator  :自定义运算符

protocol  :协议

struct  :结构体

subscript  :下标

typealias  :重命名某方法 typealias Feet = Int

在语句中使用关键词

break  :打断

case   :条件

continue  :跳过

default  :默认

do  :做什么例如 do...while

repeat :同上 repeat...while

if   :条件判断

else   :条件判断

else if   :条件判断

switch   :条件选择

fallthrough   :语句跳转 用在switch中跳转执行某段代码有fallthrough的代码都要并且跳转到default

for   :循环

for in   :循环

while   :循环

where  :接在case后判断执行 case let (x, y) where x == y:

在表达式和类型中使用关键字

asdynamicTypefalseis
nilselfSelfsuper
true_COLUMN__FILE__FUNCTION_
_LINE_

在特定情况下使用的关键字

associativityconveniencedynamicdidSet
finalgetinfixinout
lazyleftmutatingnone
nonmutatingoptionaloverridepostfix
precedenceprefixProtocolrequired
rightsetTypeunowned
weakwillSet