This code is from the latest Swift book, and makes it seem as if I can use files in much the same way that I would in Python (for example). But, I can't find any open() call in the standard library that will take a String as shown here.
How can I do simple file I/O in a playground?
“func processFile(filename: String) throws {
if exists(filename) {
let file = open(filename)
defer {
close(file)
}
while let line = try file.readline() {
// Work with the file.
}
// close(file) is called here, at the end of the scope.
}
}”
Excerpt From: Apple Inc. “The Swift Programming Language (Swift 4.2 beta).” iBooks. https://itunes.apple.com/us/book/the-swift-programming-language-swift-4-2-beta/id1002622538?mt=11