I am currently both reading and writing from a file in swift, and the reading works fine, while the writing seems to be doing nothing. Here is what I am using to read:
let path = NSBundle.mainBundle().pathForResource(filename, ofType: "txt")
let returnString = try? String(contentsOfFile: path!, encoding: NSUTF8StringEncoding)
and here is what I am trying to use to write:
let text = "hi mom"
let path = NSBundle.mainBundle().pathForResource(filename, ofType: "txt")
do{
try text.writeToFile(path, atomically: false, encoding: NSUTF8StringEncoding);
}
catch{
print("nope")
}
It is not throwing an error, but also not changing the file