【发布时间】:2018-12-16 15:24:23
【问题描述】:
import SwiftyJSON
let myData: [JSON] = [{"number": "1"}, {"number": "4"}, {"number": "3"}]
let sortedData = myData.sorted { $0["number"].stringValue > $1["number"].stringValue }
print(sortedData) // nil
如何在不更改字典的情况下进行排序?
我想按值高低排序。
数组中的值不是JSON吗?
我只是认为数组值与它们的输入无关,因为数组起到了排序的作用。
我错了吗?
【问题讨论】:
标签: ios json swift swifty-json