title: ios Camera app swift 3
body: <p>I want a camera interface in my app with capture and save image capabilities but i'm not able to get anything when i run this app, build is successful without any errors but nothing is showing on the viewController.</p>
  
  <pre><code>class ViewController: UIViewController , UINavigationControllerDelegate, UIImagePickerControllerDelegate{
  
  @IBOutlet var imageView: UIImageView!
  
  
  @IBOutlet var TakePhoto: UIButton!
  var imagePick: UIImagePickerController!
  var newMedia: Bool?
  
  @IBAction func TakePhoto(_ sender: AnyObject){
  
      if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera){
          let imagePick = UIImagePickerController()
          imagePick.delegate = self
          imagePick.sourceType = UIImagePickerControllerSourceType.camera
          imagePick.mediaTypes = [kUTTypeImage as String]
          imagePick.allowsEditing = false
  
          self.present(imagePick, animated: true, completion: nil)
  
          newMedia = true
  
      }
  
  }
  
  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
      let mediaType = info[UIImagePickerControllerMediaType] as! NSString
      if mediaType.isEqual(to: kUTTypeImage as String){
          let image = info[UIImagePickerControllerOriginalImage] as! UIImage
          imageView.image = image
  
          if(newMedia == true){
             UIImageWriteToSavedPhotosAlbum(image, self, #selector(ViewController.image(image:didFinishSavingWithError:contextInfo:)), nil)
          } //else if mediaType.isEqual(to: kUTTypeMovie as String)
  
          self.dismiss(animated: true, completion: nil)
  
      }
  }
  
  func image(image: UIImage, didFinishSavingWithError error: NSErrorPointer, contextInfo:UnsafeRawPointer){
      if error != nil{
          let alert = UIAlertController(title: "Save Failed", message: "Failed to save the image", preferredStyle: UIAlertControllerStyle.alert)
  
          let cancelAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
  
          alert.addAction(cancelAction)
          self.present(alert, animated: true, completion: nil)
      }
  }
  </code></pre>
  
  <p>}</p>