var numDict = [String: Int]()
numDict = ["age": 2, "total": 3]
var numArray = [Int]()
numArray = [1,2,3,4]
var dictArray = [Dictionary]() // Error: "Missing argument for parameter #1 in call"
the last line cause Error.
How should I Create Array of Dictionary?
You need to define the types for the dictionary inside the array:
var dictArray = [[String:Int]]()
In long form this would be:
var dictArray = Array<Dictionary<String,Int>>()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.