I used the Files in the first Rugby version.
But this library has some drawbacks:
-
There are some issues with files enumeration;
-
It has limited testability;
-
Now it looks like a public archive. The last request was merged in 2022.
Fish
is a small library that was developed to solve the above problems.
It providing convenient wrappers for interacting with the file system.
Under the hood it uses FileManager
and other parts of Foundation
.
This library was a part of π Rugby 2.x.
Add it to the dependencies for your package. More info here.
.package(url: "https://github.com/swiftyfinch/Fish", from: "0.1.0")
let file = try Folder.current.createFile(
named: "example.txt",
contents: "Hello world!"
)
try file.append("You can find more info in docs.")
try file.delete()