I have ViewController with AVCaptureSession. I can start and stop AVCaptureSession easily :
var captureSession: AVCaptureSession?
captureSession = AVCaptureSession()
//start
captureSession?.startRunning()
//stop
captureSession?.stopRunning()
A want to know how can I stop AVCaptureSession when user opens another ViewController.
Just have the viewWillDisappear method handle that for you.
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
captureSession?.stopRunning()
}