I\'ve been learning about Swift and building an Cocoa app which is based on Swift, and faced the issue that Swift\'s built-in Array
type doesn\'t have wri
This will work...
let array = ["One", "Two", "Three"] as NSArray
array.writeToFile("/Users/xxx/Desktop/trial.txt", atomically:true)
Output is:
One
Two
Three
But you must cast it as an NSArray
let array = ["One", "Two", "Three"] // Native Swift array will not work
array.writeToFile("/Users/xxx/Desktop/trial.txt", atomically:true)
will not work.