Frog
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.
Read:
let path = "path/to/your/file"
let input = Frog(path)
if let newLine = input.readLine() {
print(newLine)
}
Write:
let path = "path/to/your/file"
let output = Frog(path, mode: .w)
output.write(line: "Croak-croak")
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
Frog is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Frog'
Author
Vyacheslav Khorkov, [email protected]
License
Frog is available under the MIT license. See the LICENSE file for more info.