Skip to content

Easy way to handle File Manager in Swift.

Notifications You must be signed in to change notification settings

verizxn/VZFileManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift Build

VZFileManager

Easy way to handle File Manager in Swift.

Example code

let file = VZFileManager(name: "test.txt")
file.save(contents: "This is a test") //Save string to the file

print(file.exists()) //Check if file exists
print(file.getString() ?? "Not a string") //Get the content of the file, if it's plain text

file.delete() //Delete the file

Advanced example code

let file = VZFileManager(name: "image.png")
let image = UIImage(systemName: "pencil")

//Save image data to the file
if let data = image.pngData() {
    file.save(contents: data)
}

// Get data, if it's data
if let data = file.getData() {
    let image2 = UIImage(data: data)

    // [...]
}