Skip to content

Conversation

@ConfusedVorlon
Copy link

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]

@squeaky-nose
Copy link

it would be nice to merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants