1.http
使用第三方 Alamofire 网络请求框架
- 字典--Dictionary
// key-value 键值对
let dict = ["name":"张三", "age":"20", "gender":"男"]
dict["name"]// 键--key
// key-value 键值对
let dict:[String:Any] = ["name":"张三", "age":20, "gender":"男"]
dict["name"]// 键--key
3.JSON
使用JOSN Editor
4.SwiftyJOSN
第三方 SwiftyJOSN
5.元组
let error = (404, "Not Found")
error.0
error.1
let (code, message) = error
print("this is code \(code)")
let (justCode, _) = error
print("this is code \(justCode)")
let succes200Code = (httpCode:200, httpMessage:"ok")
print("this is code \(succes200Code.httpCode)")