I am trying to load some data from my plist into an array. While declaring an array i did something like this
var natureList : [Dictionary] = [] as! [Dictionary]
So how do i declare an array to load this data from my plist. ? I know its simple but this small thing is eating my head. Any help appreciated.
It should be declared as follows:
var natureList = [[String: Any]]()
or as @LeoDabus advised (thanks to him):
var natureList: [[String: Any]] = []
Means that natureList
is an array of dictionaries of strings as keys and any as values.
If you are aiming to declare it using Dictionary
-which is uanessacry-, you could also do it like this:
var natureList = [Dictionary<String, Any>]()