Skip to content

A few drop-in SwiftUI components for easily importing and thumb-nailing files

License

Notifications You must be signed in to change notification settings

briannadoubt/FilesUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FilesUI

A few drop-in SwiftUI components for easily importing and thumb-nailing files

Usage

1. Import Files

To import files you can use the FileImporterButton:

FileImporterButton(types: [.fileURL], url: { url in print(url) })

This button also supports drag and drop for the specified UTTypes

2. Display thumbnail

To display a thumbnail of the imported file you can use FileThumbnailView with FileImporterButton:

struct MyView: View {
    @State var importedFileUrl: URL?
    
    var body: some View {
        if let url = importedFileUrl {
            FileThumbnail(url: importedFileUrl)
        } else {
            FileImporterButton(types: [.fileURL]) { url in
                self.importedFileUrl = url
            }
        }
    }
}

About

A few drop-in SwiftUI components for easily importing and thumb-nailing files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages