这是我的数组
var docData: [String: Any] = [
"timestamp":Int64(Date().timeIntervalSince1970 * 1000),
"photo": photo_uri,
"name": name.text ?? "
]
我想将下一个项目添加到数组[“email”:email.text ?? “”]
以下不起作用
docData += ["email": email.text ?? ""]
答案 0 :(得分:3)
You didn't create an array... you created a dictionary. In which case you would set the key to the value. A dictionary is a collection of key and value pairs.
docData["email"] = email.text ?? ""