How to use MobilliumQRCodeReader library in Swift
Hi everyone,
In this article, I will try to explain how to use MobilliumQRCodeReader library in your swift projects.
Installation
MobilliumQRCodeReader library can be installed via Cocoapods and Swift Package Manager. Get more details from Github page.
- Cocoapods
pod 'MobilliumQRCodeReader'
- Swift Package Manager
dependencies: [
.package(url: "https://github.com/mobillium/MobilliumQRCodeReader.git", .upToNextMajor(from: "1.1.0"))
]
Note: Camera permission key must be added into your info.plist file.
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera description.</string>
Usage
First of all, import MobilliumQRCodeReader into your class then initialize QRCodeReaderViewController with default values or you can customize for your requirements and set delegate. Also you can choose image from gallery to read QR code.
QRCodeReaderDelegate methods:
- Basic Usage
Initialize QRCodeReaderViewController with default values, set delegate and it is ready to use.
- Advanced Usage
MobilliumQRCodeReader comes with these configs which you can customize for your requirements.
- PreviewLayer
- CloseButton
- InfoLabel
- GalleryButton
- SettingsAlert