I edited the .plist file. As I understand it: because of the sandbox, you can read files inside the .playgrounds file in the Resources directory. But how can I write the edited file to this folder?
// read file let xmlPath: String = NSBundle.mainBundle().pathForResource("Settings", ofType: "plist")! var xmlDictionary: [String : AnyObject] = NSDictionary(contentsOfFile: xmlPath) as Dictionary<String, AnyObject> // editing file // ... // saving file let saveDict: NSDictionary = xmlDictionary as NSDictionary let savePath: String = xmlPath.stringByDeletingLastPathComponent.stringByAppendingPathComponent("Saved.plist") saveDict.writeToFile(savePath, atomically: false) // ~> false
Whether savePath and xmlPath , returns false , which does not mean success.
It would be nice if I could replace the old (non-editable) version of the .plist file, but saving to a new file would also be fine.
source share