swift - parse dictionary with different keys and values -


i have dictionary this:

var mapnames: [string: [string]] =      [           "a": ["a1", "a2"],           "b": ["b1"],           "c": ["c1", "c2", "c3"]     ] 

now have 1st view controller's tableview's func:

override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) {   //i want print "a", "b", "c" here.  } 

in 2nd view controller's tableview' func:

override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {    //if user taps on "a" in 1st vc, show here cells "a1", "a2"  }   

can how can parse dictionary list of keys first , each key, list of corresponding values ?

thanks.

as pointed eric, should read documentation first. key - value of dictionary, need this:

for (key, value) in mapnames {    print(key)    print(mapnames[key]) } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -