I was wondering what the simplest and cleanest to read a text file into an array of strings is in swift.
Text file:
line 1 line 2 line 3 line 4
Here is a way to convert a string to an array(Once you read in the text):
var myString = "Here is my string" var myArray : [String] = myString.componentsSeparatedByString(" ")
This returns a string array with the following values: ["Here", "is", "my", "string"]
["Here", "is", "my", "string"]