Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting more properties for ImagePicker/UIImagePickerController. #446

Open
edonv opened this issue Aug 25, 2023 · 0 comments
Open

Setting more properties for ImagePicker/UIImagePickerController. #446

edonv opened this issue Aug 25, 2023 · 0 comments
Assignees

Comments

@edonv
Copy link

edonv commented Aug 25, 2023

It would be great if more of UIImagePickerController's properties were exposed, like videoQuality. Maybe it could just be a configuration closure property that's used to configure the view controller:

var configurationHandler: (UIViewControllerType) -> Void

...

public func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
    context.coordinator.base = self
    
    uiViewController.allowsEditing = allowsEditing
    uiViewController.sourceType = sourceType
    
    if let mediaTypes = mediaTypes, uiViewController.mediaTypes != mediaTypes  {
        uiViewController.mediaTypes = mediaTypes
    }
    
    if uiViewController.sourceType == .camera {
        uiViewController.cameraDevice = cameraDevice ?? .rear
    }

   configurationHandler(uiViewController)
}

Edit:

extension ImagePicker {
    public func configuration(_ handler: @escaping (UIViewControllerType) -> Void) -> Self {
        then({ $0. configurationHandler = handler })
    }
}
@vmanot vmanot self-assigned this Nov 2, 2023
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

No branches or pull requests

2 participants