https://github.com/mertozseven/qrreader
A powerful xcframework that provides a simple and customizable QR code and barcode scanning experience using VisionKit framework.
https://github.com/mertozseven/qrreader
barcode-scanner ios-swift qrcode qrcode-scanner swift uikit vision-framework xcframework
Last synced: 3 months ago
JSON representation
A powerful xcframework that provides a simple and customizable QR code and barcode scanning experience using VisionKit framework.
- Host: GitHub
- URL: https://github.com/mertozseven/qrreader
- Owner: mertozseven
- License: bsd-3-clause
- Created: 2025-01-18T19:49:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-12T12:35:50.000Z (about 1 year ago)
- Last Synced: 2025-03-12T13:33:05.826Z (about 1 year ago)
- Topics: barcode-scanner, ios-swift, qrcode, qrcode-scanner, swift, uikit, vision-framework, xcframework
- Language: Swift
- Homepage:
- Size: 132 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QRReader
A lightweight and efficient iOS framework for QR code scanning using Apple's VisionKit framework. Built with Swift, it provides a customizable scanning interface with real-time detection capabilities.
## Features
- 📱 Native iOS QR code scanning using VisionKit
- 🎨 Fully customizable scanner overlay
- 🎯 Region of Interest (ROI) support for precise scanning
- 💫 Real-time QR code detection
- 🔍 High-accuracy scanning
- ⚡️ High frame rate tracking support
- 🛠 Easy integration with existing projects
## Requirements
- iOS 16.0+
- Swift 5.9+
- Xcode 15.0+
## Installation
### Swift Package Manager
Add QRReader to your project through Swift Package Manager by adding the following to your Package.swift dependencies:
.package(url: "https://github.com/mertozseven/QRReader.git", from: "1.0.0")
### Manual Installation
1. Download the QRReader.xcframework
2. Drag and drop it into your Xcode project
3. Ensure it's embedded and signed in your target's settings
## Usage
### Basic Implementation
1. First, import the framework by adding this line at the top of your file:
```swift
import QRReader
```
2. Create a QRReader instance and present the scanner:
```swift
let qrReader = QRReader()
if qrReader.isScanningAvailable() {
qrReader.presentScanner(from: viewController) { scannedCode in
print("Scanned QR Code: \(scannedCode)")
}
}
```
### Customization
QRReader provides various customization options:
```swift
let qrReader = QRReader()
// Customize appearance
qrReader.overlayColor = UIColor.black.withAlphaComponent(0.5)
qrReader.cornerColor = .systemGreen
qrReader.instructionText = "Align QR code within frame"
qrReader.padding = 8
qrReader.windowSize = 250
```
### Available Properties
| Property | Type | Description | Default Value |
|----------|------|-------------|---------------|
| `overlayColor` | UIColor | Scanner overlay background color | `black.alpha(0.5)` |
| `cornerColor` | UIColor | Corner markers color | `.systemGreen` |
| `instructionText` | String | Guidance text for users | "Align the QR code within the frame to scan" |
| `padding` | CGFloat | Padding around scanner window | 8 |
| `windowSize` | CGFloat | Size of scanner window | 250 |
## Example Implementation
Here's a complete example of implementing QRReader in a view controller:
```swift
import UIKit
import QRReader
class ScannerViewController: UIViewController {
private let qrReader = QRReader()
override func viewDidLoad() {
super.viewDidLoad()
setupScanner()
}
private func setupScanner() {
// Customize appearance
qrReader.overlayColor = UIColor.black.withAlphaComponent(0.6)
qrReader.cornerColor = .systemBlue
qrReader.instructionText = "Place QR Code Here"
// Present scanner
if qrReader.isScanningAvailable() {
qrReader.presentScanner(from: self) { [weak self] code in
self?.handleScannedCode(code)
}
}
}
private func handleScannedCode(_ code: String) {
print("Scanned QR Code: \(code)")
}
}
```
## Privacy Usage Description
Add the following key to your Info.plist:
NSCameraUsageDescription
Camera access is required for scanning QR codes
## Features in Detail
- **High Performance Scanning**: Utilizes VisionKit's DataScannerViewController for efficient QR code detection
- **Customizable UI**: Fully customizable overlay, corners, and instruction text
- **Region of Interest**: Focused scanning area for better accuracy
- **Real-time Detection**: Immediate feedback when QR codes are detected
- **Memory Management**: Efficient handling of camera resources
## Demonstration

## License
This project is available under the GNU General Public License v3.0. See the LICENSE file for more info.
## Author
[Mert Adem Özseven](https://mertozseven.com)
## Support
For support, please create an issue in the GitHub repository or contact [Mert Adem Özseven](https://mertozseven.com).