             return
         }
     }
+
+    func cameraIsAvailable() -> Bool {
+
+        let status = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo)
+
+        if status == AVAuthorizationStatus.Authorized {
+
+            return true
+        }
+
+        return false
+    }
 }

    }
    
    @IBAction func flashButtonPressed(sender: UIButton) {

        do {


    }
    
    @IBAction func flipButtonPressed(sender: UIButton) {

        if !cameraIsAvailable() {

            return
        }
        
        session?.stopRunning()
        
