A simple node-like file operation library with swift.
- iOS 8.4
- Xcode 7.3 (Swift 2.2)
Using Carthage
Add github "jsenjoy/Sample.swift" to Cartfile in your project and run carthage update --platform iOS.
If unfamiliar with Carthage then checkout their Getting Started section or this sample app
Then add import Sample to the top of the files using Sample.swift.
Download the file Sample.swift and then add to your project.
do {
let content = try Sample.readFile(path)
print(content)
} catch {}access(path: String, mode: Int)appendFile(filename: String, data: String)chmod(path: String, mode: Int)chmod(path: String, mode: String)chown(path: String, uid: Int, gid: Int)mkdir(path: String)stat(path: String) -> [String: AnyObject]exists(path: String) -> Boolreaddir(path: String) -> [String]readFile(file: String) -> StringwriteFile(file: String, data: String)rename(path: String, another: String)rmdir(path: String)unlink(path: String)
Sample.swift is released under an MIT license. See the LICENSE file for more information.