SwiftUI: How to build document Scanner using Apple Visionkit?
SwiftUI + Visionkit — iOS 14 Xcode 12
2 min readMar 3, 2021
With Apple’s Visionkit, It is super easy to create a document scanner. In this demo we are going to build MVP in less than 100 line.
In this document scanner, We are going to support following feature:
- Scan one or multiple documents
- Share the Scanned Document
- Delete if Document is not needed
*Complete code at the end
Considering you have already created an empty project.
Step 1: Camera permission
Add NSCameraUsageDescription to info.plist
<key>NSCameraUsageDescription</key>
<string>your access request message</string>
Step 2:
Create a base UI, With a button using which user can open camera to scan document.