ImagePickerSwiftUI

ImagePicker for SwiftUI

Useage

set

import ImagePickerSwiftUI

   @State var selectedImage: UIImage?
   @State var showPicker: Bool = false

action

  Button {
    showPicker.toggle()
  } label: {
    Text("Show Image Picker")
  }

show

  .sheet(isPresented: $showPicker) {
    ImagePickerSwiftUI(
      selectedImage: $selectedImage,
      sourceType: .camera // or .photoLibrary
    )
  }

Add Info.plist

    <key>NSCameraUsageDescription</key>
    <string>I'll use it to take pictures.</string>

that’s all

.camera .photoLibrary
IMG_0625 Simulator Screen Shot - iPhone 13 - 2021-12-11 at 18 18 43

GitHub

View Github