VisionKit Document Scanner wrapped into a SwiftUI View
- Copy the example swift file into your project.
- Use the DocScanView with it's optional closures to handle any error or if the user cancelled the scan
- Add an NSCameraUsageDescription to the Info.plist
- Enjoy!
//hold the results
@State var images: [UIImage] = []
...
var body: some View {
DocScanView(results: $images) {
//do something if the user cancelled the scan
} failedWith: { error in
//handle any error
print("\(error.localizedDescription)")
}
}