FMPhotoPicker
FMPhotoPicker copied to clipboard
Feature/swift UI
This adds a simple wrapper for SwiftUI users
It's documented in the Readme - but essentially, it uses a standard fullscreenModal with a binding to an image or an array of images
struct ContentView: View {
@State var image:UIImage?
@State var showPicker:Bool = false
var body: some View {
VStack {
if let image {
Image(uiImage:image)
.resizable()
.frame(width:100,height:100)
}
Button("Pick a Photo") {
showPicker = true
}
}
.padding()
//Note - use fullScreenCover rather than sheet
//to avoid display issues on iPads
.fullScreenCover(isPresented: $showPicker) {
FMSwiftUIImagePicker(config: FMPhotoPickerConfig(),
selectedImage: self.$image)
}
}
}
For multiple selection - just change the binding to [UIImage]
it would be nice to merge this?