Я пытаюсь сохранить данные в файл plist в swift, но данные не отображаются, поскольку они были сохранены при чтении plist. Это код, который я использовал.
var documentsDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString
var path : NSString = documentsDirectory.stringByAppendingPathComponent("data.plist")
var data : NSMutableDictionary = NSMutableDictionary(contentsOfFile: path)
data.setObject(self.object, forKey: "key")
data.writeToFile(path, atomically: true)
Изменить: я слышал, что лучший способ сделать это - записать в каталог документов, так что мой вопрос должен состоять в том, как я должен писать в файл в этом каталоге?