Code Monkey home page Code Monkey logo

filebrowser's Introduction

FileBrowser - iOS Finder-style file browser in Swift

Build Status Version Carthage compatible

FileBrowser

iOS Finder-style file browser in Swift 4.0 with search, file previews and 3D touch. Simple and quick to use.

Features

โœจ Features
๐Ÿ“ฑ Browse and select files and folders with a familiar UI on iOS.
๐Ÿ” Pull down to search.
๐Ÿ‘“ Preview most file types. Including plist and json.
๐Ÿ“ Edit/delete files.
๐Ÿ‘† 3D touch support for faster previews with Peek & Pop.
๐Ÿ’ฎ Fully customizable.

Usage

Import FileBrowser at the top of the Swift file.

import FileBrowser

To show the file browser, all you need to do is:

let fileBrowser = FileBrowser()
present(fileBrowser, animated: true, completion: nil)

By default, the file browser will open in your app's documents directory. When users select a file, a preview will be displayed - offering an action sheet of options based on the file type.

Advanced Usage

You can open FileBrowser in a different root folder by initialising with an NSURL file path of your choice.

let fileBrowser = FileBrowser(initialPath: customPath)

You can also allow editing/deleting files.

let fileBrowser = FileBrowser(initialPath: customPath, allowEditing: true)

Use the didSelectFile closure to change FileBrowser's behaviour when a file is selected.

fileBrowser.didSelectFile = { (file: FBFile) -> Void in
    print(file.displayName)
}

To exclude a certain file type or a specific file path:

fileBrowser.excludesFileExtensions = ["zip"]
fileBrowser.excludesFilepaths = [secretFile]

Setting up with CocoaPods

source 'https://github.com/CocoaPods/Specs.git'
pod 'FileBrowser', '~> 1.0'

Setting up with Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate FileBrowser into your Xcode project using Carthage, specify it in your Cartfile:

github "marmelroy/FileBrowser"

filebrowser's People

Contributors

amyleecodes avatar delba avatar humblehacker avatar marmelroy avatar mihailsalari avatar orff avatar srikanthvkabadi avatar waterskier2007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filebrowser's Issues

warning in Xcode 10

Hi,
First of all I would like to thank you for the fantastic code.
Really it's a very nice tool.
I use it in my apps.
Now, I get the warning: "/Users/geogerar/Documents/geoWarApp_IOS10_Improved/geoWarApp/Helper_Classes/FileExplorer/Item.swift:99:9: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'Item' to 'Hashable' by implementing 'hash(into:)' instead"

is it possible for you to correct this issue...?

Thank you in advance

George

how to use it as an ios app

Hello
Can you please tell me how to use it as an ios app, the proj builds successfully but wont launches.
Any help plz?

Allow including only specific extensions

Currently, in FileBrowser, you can only exclude extensions. Now, if you have a requirement of only accepting a few extensions, this is going to be a problem as you'll have to exclude all other extensions.

To solve this, I was wondering if a new method could be implemented which allowed only specific extensions to be allowed?

Swift Package Manager support

Currently, the component supports installation only through Carthage and CocoaPods. It would be great if we add package definition so that Swift Package Manager could install it as a dependency.

Unable to edit/delete files within subdirectories

When I import this project, I can use it and everything works (mostly) as expected. My only issue is that I can't delete anything if its in a subdirectory to the initial directory. Is this a bug, or is there some sort of easy fix?

I've been scratching my head for about an hour, and I tried adding fileListViewController.allowEditing = allowEditing to the function tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath), but it doesn't appear to work the way I was hoping.

use of unresolved identifier 'present'

I am getting "use of unresolved identifier 'present'" error when i copy the code verbatim from the example:

let fileBrowser = FileBrowser()
present(file, animated: true, completion: nil)

Am I doing something wrong?
I am also importing the library at top of file and have run pod install

Swift 3

It is working for swift 3?

I am getting this errors on XCode 8.

filebrowser

Update to Xcode 10.0

When upgrading to Xcode 10 I get the following error:

dyld: Symbol not found: __T0BOWV
Referenced from: /private/var/containers/Bundle/Application/FE262A78-23EA-4235-87EF-6FBDE57A7457/LinkReactNative.app/Frameworks/FileBrowser.framework/FileBrowser
Expected in: /private/var/containers/Bundle/Application/FE262A78-23EA-4235-87EF-6FBDE57A7457/LinkReactNative.app/Frameworks/libswiftCore.dylib
in /private/var/containers/Bundle/Application/FE262A78-23EA-4235-87EF-6FBDE57A7457/LinkReactNative.app/Frameworks/FileBrowser.framework/FileBrowser

any ideas?

Path to get all files listed

Hi, what path should i use to get all the files listed on that file browser, like all the files in the phone images, documents and everything

iOS native icons

iOS has native icons for files, different than icons on macOS. Why don't use those icons? You can get icons for a file like this:

let controller = UIDocumentInteractionController(url: <#File URL#>)
controller.icons.last // The icon

UIDocumentInteractionController.icons

I can submit a pull request if you want, it's very easy to implement.

Adding slide to delete to file browser

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
    }

Button for adding new file or folder?

Hello.

Is there a way to add a new file or folder? Even better, is there a way to tether a custom action to a button in the FileBrowser's top bar?

Thanks!

Does the project support Audio video

Great project! Thanks for making it.

I put some audio / video in the sample app, seems like it is not shown up. Just wonder if it supports Audio video.

Not working with Xcode 7.3.1 !

Display just blank screen and below warning

2016-06-28 20:52:04.797 FIleBrowserDemo[2533:43383] Warning: Attempt to present <FileBrowser.FileBrowser: 0x7fbe4b849a00> on <FIleBrowserDemo.ViewController: 0x7fbe4a5a9230> whose view is not in the window hierarchy!

simulator screen shot 28-jun-2016 8 53 58 pm

import UIKit
import FileBrowser

class ViewController: UIViewController {

let fileBrowser = FileBrowser()
override func viewDidLoad() {
    super.viewDidLoad()

    self.presentViewController(fileBrowser, animated: true, completion: nil)
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

How to invoke init with parameters in objective-c?

Hi @marmelroy

First of all I would like to appreciate for creating such a nice and cool library.

I am trying to invoke file browser from objective-c class. I am able to achieve this using below code:

FileBrowser *fileBrowser = [[FileBrowser alloc] init];

I want to pass parameters as well using below init method, but it is giving me below error:

  • init(initialPath: URL? = nil, allowEditing: Bool = false, showCancelButton: Bool = true)

  • FileBrowser *fileBrowser = [[FileBrowser alloc] init: nil allowEditing: YES showCancelButton: YES]

  • No visible @interface for 'FileBrowser' declares the selector 'init:allowEditing:showCancelButton:'

Can you please guide me on how to init with parameters. Any help would be very much appreciated.

Thanks
Pranav

File list by date created?

Hi,

Thanks for a great piece of coding, works almost exactly how I want.
Is it possible to re-sort the table to display the files by the creation date or date modified? Either as a direct change to code or as an add-in option?

How to change name of Navigation bar

Hi there, I love the app! I'm new to using Swift & cocoapods and I'm wondering how I could change the name "Documents" at the top of the navigation bar to something else. If you could point me in the right direction that would be awesome! Thanks

Could not build Objective-C module 'FileBrowser'

So I just installed using CocoaPods, and I can see in Xcode that it installed to my project successfully. My problem now is that when I try to import into a swift file, Xcode gives me the error Could not build Objective-C module 'FileBrowser'.

The only thing I have tried to do with it so far is import it, but I can't even do that. Any ideas?

Can the file browser also include the size of the file?

I'm considering using this in an app for debugging purposes while in the while. One of the key things is being able to see the size of the files. I wanted to check to see if you had plans to do this. If not, it's probably something I can extend easily enough. I could code it up if you're interested.

Can't see any files

When the FIleBrowser view launches, I can't see any files at all. Edit: I now think this is due to app sandboxing? Is there a way to enable access to the phones documents and images?

It automatically removes the parent view controller?

I have a RootViewController which is a UITabBarController;
then I have a NavigationController in this RootViewController;
after that I use self.navigationController?.pushViewController(vc, animated: true) to add a vc: CustomViewController in the NavigationController

Now I have below standard code to call this package in the vc: CustomViewController

let fileBrowser = FileBrowser(initialPath: documentsURL)
present(fileBrowser, animated: true, completion: nil)
fileBrowser.didSelectFile = { (file: FBFile) -> Void in
    // things I do here...
}

However, after I select file and did those things there.
The vc: CustomViewController is removed!
It directly shows the NavigationController level.

Anyone knows how to fix this? I still need to stay in the vc: CustomViewController.

Case study

Is it possible to show files retrieved from a server? I have a Firebase database from which I download files and wanted to know if it was possible to add files to the FileBrowser or not. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.