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

Photo picker in swift #134

Open
black-lotus opened this issue Oct 24, 2016 · 6 comments
Open

Photo picker in swift #134

black-lotus opened this issue Oct 24, 2016 · 6 comments

Comments

@black-lotus
Copy link

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

@Richard3332
Copy link

I get the same error after migrating from Swift 2.3 to Swift 3.0

@yarodevuci
Copy link

@ReadmeCritic any solution how to fix?

@black-lotus
Copy link
Author

nope...
I switch to other library.. it simple but it works
here you go https://github.com/ruslanskorb/RSKImageCropper

@ReadmeCritic
Copy link
Contributor

u meant to msg @dzenbot ?

@Richard3332
Copy link

Any update on this if it will be updated for Swift 3.0?

@rollr76518
Copy link

rollr76518 commented Aug 29, 2017

Please update code like that

	picker.finalizationBlock = { (picker, info) in
		//Your code here...
	}
	
	picker.cancellationBlock = { (picker) in
		//Your code here...
	}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants