I'm working with this kind of array.
var myArray : [[String:String]] = [["1" : "Arun", "2" : "Gupta"],["1" : "John", "2" : "Cena"],["1" : "James" , "2" : "Bond"],["1" : "Iron", "2" : "Man"],["1" : "Karthik","2" : "Keyan"]]
I could assign values directly to this array and access the values through object. For example,
To access values in index zero.
let obj = myArray[0]
print(obj["1"],obj["2"])
it prints values in myArray[0]
Output:
Arun Gupta.
Now what i want is, how to append values to this kind of array instead of directly assigning values in the declaration itself.
myArray.append(["1" : "Arun", "2" : "Gupta"])var myArray = [[String:String]]()var myArray: [[String: String]] = []to initialize your array.