Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 swift 4 读取包含 20 个元素的 JSON 文件到表格视图中。这些元素是电话名称和发布年份,例如(年份、名称)。现在,我正在将它们全部成功读取到表格视图中。但是我如何将名称读入与其发布年份相关的部分。例如,在 2005 年发布的任何电话名称都将在 2005 年部分。
JSON sample : { "phones" : [ { "year": "2005", "cuisine": "Iphone 5" },{.....} }
当您将 json 解析为模型数组时,您需要按年过滤它们。每组过滤模型都将成为表格视图中的一个部分。