Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.
This repository was archived by the owner on Nov 29, 2022. It is now read-only.

Photo picker in swift #134

@black-lotus

Description

@black-lotus

Hi,

First of all
Thank you so much for making this awesome library :)

I have question, how to implement editor picker in swift since i always getting warning error
In my case, photo will cropping after photo selected from photo library or by camera.

here is my code

func takePictureFromLiblary(){
        let imagePicker =  UIImagePickerController()
        imagePicker.allowsEditing = true
        imagePicker.cropMode = DZNPhotoEditorViewControllerCropMode.Circular
        imagePicker.delegate = self

        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) {

            imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary

        } else if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum) {

            imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum

        } else {

            JLToast.makeText("Galery not available, please check your camera and try again", duration:JLToastDelay.ShortDelay).show()

        }


        imagePicker.finalizationBlock = { (picker: UIImagePickerController, info: NSDictionary) in

        }

        imagePicker.cancellationBlock = { (picker: UIImagePickerController) in

        }


        self.presentViewController(imagePicker, animated: true, completion: nil)
}

and here is warning error message

Cannot assign value of type '(UIImagePickerController, NSDictionary) -> ()' to type 'UIImagePickerControllerFinalizationBlock!'
Cannot assign value of type '(UIImagePickerController) -> ()' to type 'UIImagePickerControllerCancellationBlock!'

Any help would be appreciated :)
Thank you for advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions