Sorry if this is too simple but I'm quite new to Swift so this is all unfamiliar to me. I pasted this code into xcode and got the error above:
import Foundation
import CSV
let stream = OutputStream(toFileAtPath: "file.csv", append: false)!
let csv = try! CSVWriter(stream: stream)
try! csv.write(row: ["id", "name"])
try! csv.write(row: ["1", "foo"])
try! csv.write(row: ["1", "bar"])
csv.stream.close()
Particularly it was pointing at this line: let csv = try! CSVWriter(stream: stream)
In what seems to be the console, I got this:
Fatal error: 'try!' expression unexpectedly raised an error: CSV.CSVError.cannotOpenFile: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_Fall2018/swiftlang_Fall2018-1000.11.42/src/swift/stdlib/public/core/ErrorType.swift, line 184
Sorry if this is too simple but I'm quite new to Swift so this is all unfamiliar to me. I pasted this code into xcode and got the error above:
Particularly it was pointing at this line:
let csv = try! CSVWriter(stream: stream)In what seems to be the console, I got this:
Fatal error: 'try!' expression unexpectedly raised an error: CSV.CSVError.cannotOpenFile: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_Fall2018/swiftlang_Fall2018-1000.11.42/src/swift/stdlib/public/core/ErrorType.swift, line 184