Fixing the duplicated scan #127

This commit is contained in:
Yannick Loriot 2017-11-26 22:47:37 +01:00
parent f63c569eda
commit e969a4c5c7
1 changed files with 8 additions and 8 deletions

View File

@ -191,21 +191,21 @@ public final class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegat
*Notes: if `stopScanningWhenCodeIsFound` is sets to true (default behaviour), each time the scanner found a code it calls the `stopScanning` method.*
*/
public func startScanning() {
if !session.isRunning {
sessionQueue.async {
guard !self.session.isRunning else { return }
self.session.startRunning()
}
}
}
/// Stops scanning the codes.
public func stopScanning() {
if session.isRunning {
sessionQueue.async {
guard self.session.isRunning else { return }
self.session.stopRunning()
}
}
}
/**
Indicates whether the session is currently running.