Tiny utility for read and write file line by line in Swift. I wrote this for easier work with files in some algorithms implementations. In some cases read and write line by line in Swift take a lot of part of an implementation.
- Automatically closing a file after
deinit
a frog; - You don't need to work with pointers explicitly;
- Read and write line by line in one line.
let path = "path/to/your/file"
let input = Frog(path)
if let newLine = input.readLine() {
print(newLine)
}
let path = "path/to/your/file"
let output = Frog(path, mode: .w)
output.write(line: "Croak-croak")
To run the example project, clone the repo, and run pod install
from the Example directory first.
Frog is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Frog'
Vyacheslav Khorkov, artfintch@ya.ru
Frog is available under the MIT license. See the LICENSE file for more info.