Hi @andsoff ,
mmm, I will suggest, first at all , to catch the exception, for example in this way
do {
let content = try String(contentsOfFile: path, encoding: String.Encoding.ascii)
} catch let error {
print("File read error : \(String(describing: error.localizedDescription))")
}
Then, I'm no sure that you could decode a csv file as a string.
Anyway, should be better working when read file with Data buffer, then I suggest to use something like this
let content = try Data(contentsOf: URL(fileURLWithPath: path))
print("File read success: \(content)")
If success, content should print read bytes.
Bye
Rob
Topic:
Programming Languages
SubTopic:
Swift
Tags: