【发布时间】:2016-05-01 20:18:43
【问题描述】:
我们如何在 Swift 中创建排序字典,就像示例中一样?
数组中的值数据是随机的。值数组可能更长。
var exampleData = [ [["Section1" : ["11","Green"] ],
[["Section1" : ["23","Blue"] ],
[["Section1" : ["344","Yellow"] ],
[["Section2" : ["100","Tall"] ],
[["Section2" : ["232","Short"] ],
[["Section3" : ["112","Number"] ],
[["Section3" : ["222","String"] ],
var sortedData = [["Section1" : [ ["11","Green"], ["23","Blue"],["344","Yellow"] ]],
["Section2" : [ ["100","Tall"], ["232","Short"] ]],
["Section3" : [ ["112","Number"],["222","String"] ]]]
【问题讨论】:
-
你试过什么?您能否向我们展示您的实现,以便我们更好地理解它?
标签: arrays string swift dictionary