refactor: use guard in handleProfileScan

This commit is contained in:
William Casarin
2023-06-07 06:48:23 +02:00
parent 5f2c8223bd
commit e67dac13c6

View File

@@ -243,7 +243,10 @@ struct QRCodeView: View {
} }
func handleProfileScan(_ prof: String) { func handleProfileScan(_ prof: String) {
if scannedCode != prof { guard scannedCode != prof else {
return
}
generator.impactOccurred() generator.impactOccurred()
cameraAnimate { cameraAnimate {
scannedCode = prof scannedCode = prof
@@ -257,7 +260,6 @@ struct QRCodeView: View {
} }
} }
} }
}
func cameraAnimate(completion: @escaping () -> Void) { func cameraAnimate(completion: @escaping () -> Void) {
outerTrimEnd = 0.0 outerTrimEnd = 0.0