UIPickerView with UIActionSheet


I am new to swift and I am making an attempt so as to add an image from the gallery/digital camera to a picture view and likewise go it backward and retailer it within the array. Beneath is what I’ve to this point I can click on the button and present me an motion sheet that takes me to the gallery and the digital camera simply do not know the best way to assign it to my imageView and go the picture information again.

    @IBAction func addPhoto(_ sender: Any) {

         showSimpleActionSheet(controller: self)

func showSimpleActionSheet(controller: UIViewController) {
        let alert = UIAlertController(title: "Select a picture", message: "", preferredStyle: .actionSheet)
        alert.addAction(UIAlertAction(title: "Digicam", model: .default, handler: { (_) in
            self.getImage(fromSourceType: .digital camera)

        alert.addAction(UIAlertAction(title: "Picture Library", model: .default, handler: { (_) in
            self.getImage(fromSourceType: .photoLibrary)

        alert.addAction(UIAlertAction(title: "Cancel", model: .cancel, handler: { (_) in

        self.current(alert, animated: true, completion: {

extension NewViewController: UIImagePickerControllerDelegate,UINavigationControllerDelegate {

    func getImage(fromSourceType sourceType: UIImagePickerController.SourceType){
        if UIImagePickerController.isSourceTypeAvailable(sourceType){
            let imagePickerController = UIImagePickerController()
            imagePickerController.delegate = self
            imagePickerController.sourceType = sourceType
            self.current(imagePickerController, animated: true, completion: nil)
         } else {
            print("Supply kind is not out there")


Please enter your comment!
Please enter your name here