I am trying to create a simple CVS file in document directory on iPad or temp directory. This code is as follows:
let fileName = "test.csv"
_ = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(fileName)
I am then trying to modify the file using CSV.swift library from github like this:
let stream = OutputStream(toFileAtPath: "test.csv", append: false)!
let csv = try! CSVWriter(stream: stream) // Error at this line
try! csv.write(row: headerarray)
try! csv.write(row: dataarray)
csv.stream.close()
For some reason I am getting error saying CSV.CSVError.cannotOpenFile: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift
It doesn't look like I am creating the .csv file correctly.