marmelroy / FileBrowser

Finder-style iOS file browser written in Swift
MIT License
1.52k stars 222 forks source link

Adding slide to delete to file browser #10

Closed leongwq closed 2 years ago

leongwq commented 8 years ago

I have added this code into my project. Im wondering how could I add a delete function. I would either need a Path or URL to get NSFileManager to delete

    func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
        if (editingStyle == UITableViewCellEditingStyle.Delete) {

        }
    }

    func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        return true
    }
vishnuprasadku commented 7 years ago

Did you find a way for deletion of the selected file?

orff commented 7 years ago

Ive added this in my fork: https://github.com/orff/FileBrowser

PodFile: pod 'FileBrowser', :git => 'https://github.com/orff/FileBrowser.git'

Usage:

let customPath = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
let fileBrowser = FileBrowser(initialPath: customPath, allowEditing: true)
present(fileBrowser, animated: true, completion: nil)