Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An easy-to-use cross platform file picker for SwiftUI.

License

Notifications You must be signed in to change notification settings

iOS-Swift-Controls/FilePicker-SwiftUI

Repository files navigation

FilePicker

A cross platform file picker for SwiftUI.

License

The FilePicker package implements a SwiftUI view that can be used in both iOS and macOS. The FilePicker provides a Button that presents a platform-native file picker that is a modern way for use in SwiftUI.

Installation

Add the FilePicker package to your Xcode project using the package manager. Import FilePicker to your file.

If you are using the package with macOS, ensure that you grant appropriate File Access permissions for User Selected File under Signing & Capabilities (on the macOS target)

Example Usage

import SwiftUI
import FilePicker
struct DebugView: View {
 
 var body: some View {
 HStack {
 // 
 
 // Use custom content for the button label
 FilePicker(types: [.plainText], allowMultiple: true) { urls in
 print("selected \(urls.count) files")
 } label: {
 HStack {
 Image(systemName: "doc.on.doc")
 Text("Pick Files")
 }
 }
 
 FilePicker(types: [.plainText], allowMultiple: false, title: "pick single file") { urls in
 print("selected \(urls.count) files")
 }
 
 }
 }
 
}

Licence

Distributed under the MIT license. See LICENSE for more information.

About

An easy-to-use cross platform file picker for SwiftUI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%

AltStyle によって変換されたページ (->オリジナル) /