Awesome
ImagePickerView
ImagePickerView
wraps UIImagePickerController
for SwiftUI:
Usage example:
struct ImagePickerExampleView: View {
@State var showImagePicker: Bool = false
@State var image: UIImage?
var body: some View {
VStack {
if image != nil {
Image(uiImage: image!)
.resizable()
.aspectRatio(contentMode: .fit)
}
Button("Pick image") {
self.showImagePicker.toggle()
}
}
.sheet(isPresented: $showImagePicker) {
ImagePickerView(sourceType: .photoLibrary) { image in
self.image = image
}
}
}
}