Giter Club home page Giter Club logo

filepicker's Introduction

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.

filepicker's People

Contributors

markrenaud avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.