I know Python and I'm trying to learn Swift... I am trying to figure out how to just read a plain text file from an absolute file path
In Python,
#!/usr/bin/python
path= '/users/mu/desktop/test_file.txt'
in_file= open(path,'w').read() #Open the file for reading
for line in in_file.split('\n'): #Split it by line breaks and print the lines
print line
Tried this one: Swift - Read Files Got: "String.Type does not have a member name stringWithContentsOfFile"
In Python, it's so easy. There must be a really simple way to read a text file and create a list of strings separated by line breaks.
My question is how to read a text file so you can iterate through the lines
Once I read the file, I could just:
for line in in_file
{
println(line)
}