iOS QR Code Scanner
A Simple iOS QR code scanner using Swift UI.
Jump to:
ContentView.swift screenshot 1.1.5
NOTE
: be aware of the new horizontal line error to internal hyperlink redirecting in Documentations
Append the ‘hr’ command right after the preceeding line of documentation to enure the overall formatting stability.
Build
Setup Debugging&Troubleshooting Commits&Pushes Steps Method Running The Project Testing Result
Contribution
Prerequisite
Developing tool: Xcode 13.4+
Swift, SwiftUI custom dependencies.
Compatibility
iPhone 11, iPhone 12, iPhone 13, iPad 10.2+
Setup
In Xcode IDE, go to info, click to add a Custom iOS Target Properties Key
Search for Privacy – Camera Usage Description
Value String: “We need the camera to scan the QR code” ->
This preset will enable users to turn on their camera Privacy for scanning
Secondarily, click to add Appearance
Value String: Light ->
If the app is used on a physical device, this functionality will automatically maximize the brightness on the user’s devices for better scannability if QR code is detected.
Next, click File->Add Packages…-> add CodeScannerDependency into Package Dependencies.
Debugging&Troubleshooting
In order to prevent the occurence of
“Cannot assign value of type ‘ScanResult’ to type ‘String’ “ error
at
self.scannedCode = code
we need to use
self.scannedCode = code.string
instead to make the value types compatible.
Commits&Pushes Steps
Must customize commit message for each commit:
Changes done in ContentView.swift file-> Save -> Source Control->Commit->Flat->Selected the committed file->Enter customized commit message down below->Select Push to Remote (origin/origin/main)-> Commit N files. Done Committing.
NOTE
: To retain each commit to Github Repositories:
Must save -> resume -> rebuild on Simulator -> push both hierarchical and flat modified files and assets remotely to the Github origin/main.
Method Running The Project
Download the project to local directory
Xcode must be 13.4
and higher versions
Compatible with MacOS Monterey 12.0
or higher versions
Enable Camera access or Local Photo Library access in local device.
Testing Result
Online QR code generator
Starting UI that prompts user to scan a QR code to get started: screenshot 1.1.6
iOS 15.5 Simulator message. Camera access isn’t available on Xcode Simulator, so select a custom image: screenshot 1.1.7
Testing on url link: screenshot 1.0.7
screenshot 1.0.8
Testing on random text: screenshot 1.1.0
screenshot 1.1.1
Testing on image: screenshot 1.1.2
screenshot 1.1.3
screenshot 1.1.4
Author
Krystal Zhang https://github.com/KrystalZhang612
This file was generated by QRCodeScanner-readme, on June 18, 2022