Swiftpack.co - briannadoubt/FilesUI as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by briannadoubt.
briannadoubt/FilesUI 0.1.0
A few drop-in SwiftUI components for easily importing and thumb-nailing files
⭐️ 0
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/briannadoubt/FilesUI.git", from: "0.1.0")

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
            }
        }
    }
}

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Pre-release v0.1.0
3 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics