title: UIImagePickerControllerDelegate not being called, selected image never displayed
body: <p>I'm stumped.  Everything is working except it's not.  I can call up the camera interface and take or select a photo yet UIImagePickerControllerDelegate is never being called (I've put two print statements that well, never get printed). Everything is correctly connected in IB, or so I believe it is (I'm fully ready for it so be something totally minor that I missed). Anyone care to take a frtesh set of eyes and go over this to see if I just can't see the forest for the trees?</p>
  <p>Thanks in advance.</p>
  <pre><code>import UIKit
  import Foundation
  
  
  class afterPhotoViewController: UIViewController {
  
      //MARK: - IBOutlet Properties
      @IBOutlet weak var afterImageView: UIImageView!
      @IBOutlet weak var aftervwImage: UIView!
      
      @IBOutlet weak var cameraBtnPressed: UIButton!
      
      //MARK: - Useful Variables
      let afterImagePicker = UIImagePickerController()
      var hud = HKProgressHUD()
      var localTextFilePath : URL!
      var isImageSetted = false
  
      //MARK: - App Delegates
      var isMain = false
      var originFrame = CGRect()
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Init UI Components
          self.initUI()
      }
      
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
      
      //MARK: - UI Init
      func initUI() {
          // Set Navigation Bar
          let backButton = UIBarButtonItem(title: &quot;&quot;, style: .plain, target: navigationController, action: nil)
          navigationItem.leftBarButtonItem = backButton
          self.title = &quot;\(h_proposalNumberStr)-\(h_itemIndex)&quot;
          
          // Set ImageView
          self.afterImageView.image = #imageLiteral(resourceName: &quot;ic_placeholder&quot;)
          self.afterImageView.clipsToBounds = false
          
          
          cameraBtnPressed.layer.cornerRadius = 15
          cameraBtnPressed.layer.borderColor = UIColor.lightGray.cgColor
          cameraBtnPressed.layer.borderWidth = 1
          
          self.isImageSetted = false
          
         // self.tableView.reloadData()
          
      }
      
      //MARK: - UI Actions
      @IBAction func cameraBtnPressed(_ sender: Any) {
          //Create the AlertController and add Its action like button in Actionsheet
          let actionSheetController: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
          
          let cancelActionButton = UIAlertAction(title: &quot;Cancel&quot;, style: .cancel) { _ in
          }
          actionSheetController.addAction(cancelActionButton)
          
          let chooseLibraryActionButton = UIAlertAction(title: &quot;Choose from Library&quot;, style: .default)
          { _ in
              self.isMain = true
              self.afterImagePicker.allowsEditing = true
              self.afterImagePicker.sourceType = .photoLibrary
              self.afterImagePicker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)!
              self.present(self.afterImagePicker, animated: true, completion: nil)
          }
          actionSheetController.addAction(chooseLibraryActionButton)
          
          let takePhotoActionButton = UIAlertAction(title: &quot;Take a Photo&quot;, style: .default)
          { _ in
              if UIImagePickerController.isSourceTypeAvailable(.camera) {
                  self.isMain = true
                  self.afterImagePicker.allowsEditing = false
                  self.afterImagePicker.sourceType = .camera
                  self.afterImagePicker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .camera)!
                  self.afterImagePicker.showsCameraControls = true
                  self.present(self.afterImagePicker, animated: true, completion: nil)
              } else {
                  Helper.showMessage(vc: self, title: CONSTANTS.APPINFO.APP_NAME, bodyStr: &quot;No camera available.&quot;)
              }
          }
          actionSheetController.addAction(takePhotoActionButton)
          
          self.present(actionSheetController, animated: true, completion: nil)
      }
     
      
  //MARK: - UIImagePickerControllerDelegate
  extension afterPhotoViewController: UIImagePickerControllerDelegate,UINavigationControllerDelegate {
      func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
          print(&quot;called&quot;)
          dismiss(animated: true, completion: nil)
      }
  
      func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
          print(&quot;called2&quot;)
          //getting actual image
          var image = info[UIImagePickerControllerEditedImage] as? UIImage
  
          if image == nil {
              image = info[UIImagePickerControllerOriginalImage] as? UIImage
          }
  
              afterImageView.image = image
              // Set Imageview Corner Radius
              afterImageView.layer.cornerRadius = 5
              afterImageView.clipsToBounds = true
  
              self.isImageSetted = true
  
          picker.dismiss(animated: true, completion: nil)
      }
  }
  </code></pre>