twostraws / CodeScanner

A SwiftUI view that is able to scan barcodes, QR codes, and more, and send back what was found.
MIT License
1.02k stars 293 forks source link

Remove vibration playing after found the code #24

Closed getogrand closed 3 years ago

getogrand commented 3 years ago

I think the behavior that playing a vibration after found the code is out of the scope of this library. It's impossible to customize such as using haptic notification or beep sound.

I met this problem during to use to make our production app. In specific, I want to use UINotificationFeedbackGenerator#notificationOccurred(.success) after found the code, not the vibration which is too heavy and uncomfortable feedback.

CodeScanner already has a grate point to handle this: completion: @escaping (Result<String, ScanError>) -> Void. The users can add their own logic in completion handler, so it's now more flexible.

xremix commented 3 years ago

Totally support this. Thanks @getogrand, I was just about to make the same PR :-) In addition you could also add your sample of UINotificationFeedbackGenerator to the Readme.md

Thanks for building this awesome library @twostraws!