2015-10-28 88 views
2

我想在plist字符串中添加一个变量。有可能这样做?在plist字符串中添加变量

例如在数组中的项0中。字符串是“今天是XXXXX” 在我的swift文件中,我能够加载plist和String。但是,我怎样才能将我的变量插入到plist字符串中?我应该如何放置我的plist以及在我的swift文件中编码?

感谢

+1

希望这可以帮助http://stackoverflow.com/questions/25100262/save-data-to-plist-file-in-swift –

回答

0
var myDict: NSDictionary? 
if let path = NSBundle.mainBundle().pathForResource("Config", ofType: "plist") { 
    myDict = NSDictionary(contentsOfFile: path) 
} 
if let dict = myDict { 
    // Use your dict here 
}