Created array of dictionary having buttons.
创建的UITableviewcell.xib和.swift 创建的ib 连锁ib 链接的数据源和代理 需要进一步的帮助来读取我的plist数据并将其显示到tableViewCell
答案 0 :(得分:0)
使用Decodable
,非常简单
struct Section : Decodable {
let title, icon : String
}
如果该文件位于捆绑包中,则将其读取为Data
并对其进行解码
let url = Bundle.main.url(forResource: "sections", withExtension: "plist")!
do {
let data = try Data(contentsOf: url)
let result = try PropertyListDecoder().decode([Section].self, from: data)
} catch { print(error) }
result
将包含Section
个项目的数组