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: 4 months 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 (8 months ago)
- Last Synced: 2024-10-10T13:28:49.535Z (4 months 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
[](https://github.com/Nef10/FileSelectorView/actions?query=workflow%3A%22CI%22) [](https://nef10.github.io/FileSelectorView/) [](https://github.com/Nef10/FileSelectorView/blob/main/LICENSE) [](https://github.com/Nef10/FileSelectorView/releases)  
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.