Swift - Write an Array to a Text File
问题 I read into myArray (native Swift) from a file containing a few thousand lines of plain text.. myData = String.stringWithContentsOfFile(myPath, encoding: NSUTF8StringEncoding, error: nil) var myArray = myData.componentsSeparatedByString("\n") I change some of the text in myArray (no point pasting any of this code). Now I want to write the updated contents of myArray to a new file. I've tried this .. let myArray2 = myArray as NSArray myArray2.writeToFile(myPath, atomically: false) but the file