title: Taking Video/Photo With ImagePickerController And Using Them On Different View
body: <p>Can someone guide me in the right direction on how to use a photo or video just taken from imagepicker in another view.</p>
  
  <p>Say I call it from my main view when pressing a camera button. I want to take a picture or video and then use it. I would like to do this in another view where I can have different custom buttons that would allow me to share it to Facebook, what-have-you as well as get back to my main view. How would I go about doing this?</p>
  
  <p>Here is the code I have so far.</p>
  
  <pre><code>//
  //  ViewController.swift
  //  Cop Watch
  //
  //  Created by James Combs on 4/16/15.
  //  Copyright (c) 2015 James's Source Code. All rights reserved.
  //
  
  import Foundation
  import UIKit
  
  class MainViewController: UIViewController, CameraViewControllerDelegate,  UITextViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
  
  @IBOutlet internal var photosButton: UIBarButtonItem!
  @IBOutlet internal var cameraButton: UIBarButtonItem!
  @IBOutlet internal var goodBadInput: UITextField!
  @IBOutlet internal var stoppedInput: UITextField!
  @IBOutlet internal var ethnicityInput: UITextField!
  @IBOutlet internal var nameInput: UITextField!
  
  internal var imagePickerController: UIImagePickerController?
  internal var camViewController: CameraViewController?
  internal let camSourceError = "Camera is not available"
  
  private var hasCancelledVideo: Bool = false
  private var hasCancelledPhoto: Bool = false
  private let cameraViewIdent = "CameraViewController"
  private let photoViewIdent = "PhotoViewController"
  
  
      // Tried doing things here but unsure how to use this correctly for now with image picker
  func cameraViewControllerDidFinish(controller: CameraViewController, imagePicker: UIImagePickerController) {
  
      /*imagePicker.delegate = self
  
      if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) {
          imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
      }
  
      imagePicker.allowsEditing = true
      controller.presentViewController(imagePicker, animated: true, completion: nil)
      controller.navigationController?.popViewControllerAnimated(true)*/
  }
  
  func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
  
      self.dismissViewControllerAnimated(true, completion: nil)
  }
  
  func imagePickerControllerDidCancel(picker: UIImagePickerController) {
  
      self.dismissViewControllerAnimated(true, completion: nil)
  }
  
  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  
      if segue.identifier == self.cameraViewIdent {
  
              // Get a reference to the camera view controller - I THINK I COULD COMBINE THESE 2 IN ONE
          if let destinationVC = segue.destinationViewController as? CameraViewController {
  
          }
      }
      else if segue.identifier == self.photoViewIdent {
  
              // Get a reference to the photo view controller
          if let destinationVC = segue.destinationViewController as? PhotosViewController {
  
  
          }
      }
  }
  
  @IBAction func didPressPhotosButton(sender: AnyObject) {
  
  }
  
  @IBAction func didPressCameraButton(sender: AnyObject) {
  
      self.imagePickerController = UIImagePickerController()
      self.imagePickerController!.delegate = self
  
      if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) {
          self.imagePickerController!.sourceType = UIImagePickerControllerSourceType.Camera
      }
  
      var availableMediaTypes = UIImagePickerController.availableMediaTypesForSourceType(self.imagePickerController!.sourceType)
  
      self.imagePickerController!.mediaTypes = availableMediaTypes!
      self.imagePickerController!.allowsEditing = false
      self.presentViewController(self.imagePickerController!, animated: true, completion: nil)
  
  
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  
  }
  
  override func viewDidAppear(animated: Bool) {
  
  }
  
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  /*
      UITextField Delegates
  */
  
  override func touchesBegan(touches: Set&lt;NSObject&gt;, withEvent event: UIEvent) {
  
      self.view.endEditing(true)
  }
  
  func textFieldShouldReturn(textField: UITextField!) -&gt; Bool {
  
      goodBadInput.resignFirstResponder()
      stoppedInput.resignFirstResponder()
      ethnicityInput.resignFirstResponder()
      nameInput.resignFirstResponder()
  
      return true
  }
  
  
  }
  </code></pre>