Reputation: 453
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?
Upvotes: 2
Views: 4035
Reputation: 94683
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>>()
Upvotes: 4