gpt4 book ai didi

swift - 将 Info.plist 键转换为字典数组

转载 作者:行者123 更新时间:2023-11-28 12:13:57 25 4
gpt4 key购买 nike

在我的 Info.plist 中,我有一个国家列表来提供 HTML 选择。

格式如下:

<key>HTMLSelectData</key>
<array>
<dict>
<key>code</key>
<string>AF</string>
<key>name</key>
<string>Afghanistan</string>
</dict>
<dict>
<key>code</key>
<string>AL</string>
<key>name</key>
<string>Albania</string>
</dict>
<dict>
<key>code</key>
<string>DZ</string>
<key>name</key>
<string>Algeria</string>
</dict>

有什么方法可以将其转换为 Swift 字典数组吗?

最佳答案

Info.plist 的内容可以通过 BundleinfoDictionary 访问

let htmlSelectData = Bundle.main.infoDictionary!["HTMLSelectData"] as! [[String:String]]

关于swift - 将 Info.plist 键转换为字典数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47506052/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com