Skip to content

AlexBa/FileKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileKit

FileKit is the easy way to handle all your files and directories on the disk. Build on top of the NSFileManager and with pure swift, it's all you need to build great apps.

Get Started

At first you have to import the framework into your project. All you need to do is to write a simple import statement.

import FileKit

Examples

Create a file

var file = File("~/Desktop/test.txt")
file.create()
file.content = "Just a test!"

Create a directory

var directory = Directory("~/Documents/cat.png")
var root = Directory.root
var home = Directory.home?
var applications = Directory.applications?
var music = Directory.music?
var movies = Directory.movies?
// And many more...

Handle Paths

var pathToRoot = Path("/") 
var directory = Directory(path: pathToRoot)

var pathToImage = Path.home.child("pictures/funny-cat.png")
var file = File(path: pathToImage)

Copy a file into a directory

var file = File("~/Pictures/hilarious-duck.png")
if var directory = Directory.desktop? {
    directory.add(file)
}

List the content of the home directory

if var items = Directory.home?.content {
    for item in items {
        println(item.name)
    }
}

Todo's

  • Write Unit Tests

License

FileKit is a private project and it's not allowed to share any code without the permission of the project owner.

Contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published