Plist文件的创建与数据获取
作者:
古月思吉 | 来源:发表于
2019-01-20 00:03 被阅读0次//MARK: - Plist文件相关
extension HomeVC {
//创建“HomePage.plist”文件
func createHomePagePlistFileWithDict(dict:NSDictionary) {
let documentsDirectory = FilePathTool.share.documentPath as NSString
let plistPath = documentsDirectory.appendingPathComponent("HomePage.plist")
dict.write(toFile: plistPath, atomically: true)
}
//获取“HomePage.plist”文件的内容
func getDictFromHomePagePlist() -> NSDictionary {
let plistPath = Bundle.main.path(forResource: "HomePage", ofType: "plist")
let dict = NSDictionary.init(contentsOfFile: plistPath!)
return dict!
}
}
本文标题:Plist文件的创建与数据获取
本文链接:https://www.haomeiwen.com/subject/bxmtjqtx.html
网友评论