Swift的关键字

在声明中使用关键字

 let   :声明一个常量swift

var  :声明一个变量ide

class  :声明一个类函数

static  :静态的post

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

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

enum  :枚举code

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

func  :声明一个函数ip

import  :导入头文件ci

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:

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

as dynamicType false is
nil self Self super
true _COLUMN_ _FILE_ _FUNCTION_
_LINE_
 
 
 

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

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
相关文章
相关标签/搜索