photo-editor
photo-editor copied to clipboard
How to use this features in a function
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
guard let image = info[UIImagePickerControllerOriginalImage] as? UIImage else {
// picker.dismiss(animated: true, completion: nil)
return
}
picker.dismiss(animated: true, completion: nil)
let photoEditor = PhotoEditorViewController(nibName:"PhotoEditorViewController",bundle: Bundle(for: PhotoEditorViewController.self))
photoEditor.photoEditorDelegate = self
photoEditor.image = image
//Colors for drawing and Text, If not set default values will be used
//photoEditor.colors = [.red, .blue, .green]
//Stickers that the user will choose from to add on the image
for i in 0...10 {
photoEditor.stickers.append(UIImage(named: i.description )!)
}
//To hide controls - array of enum control
//photoEditor.hiddenControls = [.crop, .draw, .share]
present(photoEditor, animated: true, completion: nil)
}
i want to execute this code in a function. how to do that.?