@H_502_0@字符串 @H_502_0@NSString ---> String "String" 直接双引号 可以像脚本语言一样直接对字符串想加减,可以带入变量 @H_502_0@let c = "cap"
"a"+"b"+c = "abcap"
let d = "I have \(c) apples"// \(c)将常量c填充入字符串,类似format、
@H_502_0@数组 @H_502_0@NSArray --->声明空数组的话使用[] 或者let emptyArray = [String]() @H_502_0@let arr = ["a","b","c"] @H_502_0@NSMutableArray---> @H_502_0@var arr = ["a","c"] @H_502_0@arr[0] = "apple" //替换元素 @H_502_0@
@H_502_0@字典 @H_502_0@NSDictionary--->声明空字典的话使用[:] 或者let emptyDictionary = [String: Float]() @H_502_0@let dic = ["keyA":"A","keyB":"b","keyC":"c"] @H_502_0@NSMutableDictionary---> @H_502_0@var dic = ["keyA":"A","keyC":"c"] @H_502_0@//addobject 添加
@H_502_0@dic["KeyD"]="D" //相当于字典addobject @H_502_0@
//setobject 设置
dic["D"] = "Dan"
print("dic=",dic)
//removeObjectForKey 移除某个key和对应的键值
dic["D"] = nil
//removeAllobject 移除所有
dic = [:]
print("dic)