I was wondering what the simplest and cleanest to read a text file into an array of strings is in swift.
var array = ["line 1","line 2","line 3","line 4"]
var name: String!
var email: String!
First you must read the file:
let text = String(contentsOfFile: someFile, encoding: NSUTF8StringEncoding, error: nil)
Then you separate it by line using the
let lines : [String] = text.componentsSeparatedByString("\n")