Created
May 3, 2017 20:46
-
-
Save b-r-o/9553c0cbff4b0700ae0dcb8ee2058e97 to your computer and use it in GitHub Desktop.
Wrap up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func flipCamera() { | |
sessionQueue.async { [unowned self] in | |
self.captureSession.beginConfiguration() | |
guard let currentCaptureInput = self.captureSession.inputs.first as? AVCaptureInput else { return } | |
self.captureSession.removeInput(currentCaptureInput) | |
guard let currentCaptureOutput = self.captureSession.outputs.first as? AVCaptureOutput else { return } | |
self.captureSession.removeOutput(currentCaptureOutput) | |
self.position = self.position == .front ? .back : .front | |
self.configureSession() | |
self.captureSession.commitConfiguration() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment