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.