0

I'm following previous advice to write to a file in Xcode 7 with Swift 2, e.g.

let loopOmega = "      endloop"
try loopOmega.writeToFile(path, atomically: false, encoding: NSUTF8StringEncoding)
let facetOmega = "   endfacet"
try facetOmega.writeToFile(path, atomically: false, encoding: NSUTF8StringEncoding)

When I track down the file in the simulator's file space, I see only the final line, which makes me think that the buffer is getting overwritten, as opposed to going to the file. How can I flush the buffer with each line?

NightShadeQueen
  • 3,284
  • 3
  • 24
  • 37
Paul
  • 1
  • 1
  • possible duplicate of [Append text or data to text file in Swift](http://stackoverflow.com/questions/27327067/append-text-or-data-to-text-file-in-swift) – Eric Aya Aug 30 '15 at 00:57
  • Because I'm trying to create and look at files in an iOS Simulator, I ended up modifying the suggestions, but got it to work! Thank you. – Paul Aug 30 '15 at 16:48

0 Answers0