DZNPhotoPickerController
DZNPhotoPickerController copied to clipboard
Photo picker in swift
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
I get the same error after migrating from Swift 2.3 to Swift 3.0
@ReadmeCritic any solution how to fix?
nope... I switch to other library.. it simple but it works here you go https://github.com/ruslanskorb/RSKImageCropper
u meant to msg @dzenbot ?
Any update on this if it will be updated for Swift 3.0?
Please update code like that
picker.finalizationBlock = { (picker, info) in
//Your code here...
}
picker.cancellationBlock = { (picker) in
//Your code here...
}