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
相關文章
相關標籤/搜索