Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nef10/fileselectorview
A small Swift UI Package with one View to select a file
https://github.com/nef10/fileselectorview
swiftui
Last synced: 12 days ago
JSON representation
A small Swift UI Package with one View to select a file
- Host: GitHub
- URL: https://github.com/nef10/fileselectorview
- Owner: Nef10
- License: mit
- Created: 2020-07-13T05:44:47.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-08T01:54:11.000Z (4 months ago)
- Last Synced: 2024-10-10T13:28:49.535Z (29 days ago)
- Topics: swiftui
- Language: Swift
- Homepage:
- Size: 201 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FileSelectorView
[![CI Status](https://github.com/Nef10/FileSelectorView/workflows/CI/badge.svg?event=push)](https://github.com/Nef10/FileSelectorView/actions?query=workflow%3A%22CI%22) [![Documentation percentage](https://nef10.github.io/FileSelectorView/badge.svg)](https://nef10.github.io/FileSelectorView/) [![License: MIT](https://img.shields.io/github/license/Nef10/FileSelectorView)](https://github.com/Nef10/FileSelectorView/blob/main/LICENSE) [![Latest version](https://img.shields.io/github/v/release/Nef10/FileSelectorView?label=SemVer&sort=semver)](https://github.com/Nef10/FileSelectorView/releases) ![platforms supported: macOS](https://img.shields.io/badge/platform-macOS-blue) ![SPM compatible](https://img.shields.io/badge/SPM-compatible-blue)
A small Swift UI Package with one View to select a file.
## Usage
Simple example:
```
@State private var fileURL: URL?
...
var body: some View {
...
FileSelectorView(allowedFileTypes: ["txt", "md"], url: self.$fileURL)
...
}
```With a label in the body:
```
var body: some View {
...
HStack(alignment: .firstTextBaseline) {
Text("Document:")
FileSelectorView(allowedFileTypes: ["txt", "md"], url: self.$fileURL)
}
...
}
```Do disable a button (for example the continue button in a form) until a file is selected:
```
Button("Continue") { ... }
.disabled(fileURL == nil)
```You can check out the complete documentation [here](https://nef10.github.io/FileSelectorView/).
## Screenshots
| No file selected | File selected | File selected with label |
| :---: | :---: | :---: |
| | | |## Include
The library supports the Swift Package Manger, so simply add it to the Swift Packages tab of your Xcode project.