Hi,
The presentation "Capture Machine Readable Codes and Text with VisionKit" mentions at the end that the DataScannerViewController can be used with an async stream. In the presentation, there is a code snipper for the updateViewAsyncStream method, but it's not really used anywhere. How do utilize this when the DataScannerViewController is active and capture the recognized items?
Also there is a sendDidChangeNotification() function sat the end but the compiler complains that it's not in scope.
Thanks.
Hi!
- Create your data scanner and store it somewhere, like a property of whatever class you're in.
- Then present the data scanner and call
startScanning(). - Call a method similar to the snippet,
updateViaAsyncStream(). Yours should grab a stream from the data scanner created in step 1. Iterate it via afor-await-in.
You should then start seeing periodic calls to the code within the loop.
The sendDidChangeNotification() isn't meant to do anything (it's not a method on data scanner). It represents a method you can have in your code. At that point in the sample, currentItems has all the items currently recognized on the screen and you can do whatever you need with it. Hope that helps.