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 1.0.0
A few drop-in SwiftUI components for easily importing and thumb-nailing files
⭐️ 2
🕓 2 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/briannadoubt/FilesUI.git", from: "1.0.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: 2
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

First production release
2 years ago

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