Skip to content

lorenzofiamingo/swiftui-photos-picker

Repository files navigation

SwiftUI PhotosPicker 🌇

PhotosPicker is a photos picker sheet, based on PHPickerViewController. Currently supports only iOS and Mac Catalyst.

Usage

PhotosPicker has similar API and behavior as other Presentation Modifiers.

import SwiftUI
import PhotosPicker

struct ContentView: View {
    
    @State private var showingPicker = false
    
    var body: some View {
        Button("Choose image") {
            showingPicker = true
        }
        .photosPicker(isPresented: $showingPicker) { photos in
            if photos.count > 0 {
                print("Selected \(photos)")
            }
        }
    }
}

Installation

  1. In Xcode, open your project and navigate to FileSwift PackagesAdd Package Dependency...
  2. Paste the repository URL (https://github.com/lorenzofiamingo/swiftui-photos-picker) and click Next.
  3. Click Finish.

Other projects

SwiftUI VariadicViews 🥞

SwiftUI AsyncButton 🖲️

SwiftUI MapItemPicker 🗺️

SwiftUI CachedAsyncImage 🗃️

SwiftUI VerticalTabView 🔝

SwiftUI SharedObject 🍱