chenjie1219/SwiftScanKit
حول
ماسح ومولّد للرموز الشريطية ورموز QR، بتصميم يحاكي WeChat وAlipay.
الأعمال والماليةما يمكنك فعله
- Scan QR codes and barcodes with a ready-to-use UIKit controller.
- Choose framed or full-screen scanning with line or grid animations.
- Customize colors, hints and supported code types; use the low-light torch control.
- Generate QR codes with optional logos and Code 128 images.
النمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- +١
- خلال 15 يومًا
- +١
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلSwiftScanKit
English · 简体中文
Native QR and barcode scanning and image generation for iOS, with no third-party runtime dependencies.
Features
- Scan QR codes and barcodes with a ready-to-use UIKit controller.
- Choose framed or full-screen scanning with line or grid animations.
- Customize colors, hints and supported code types; use the low-light torch control.
- Generate QR codes with optional logos and Code 128 images.
Requirements: iOS 15+ · Swift 6.4 · Xcode 27.1+
Installation
Swift Package Manager
Add the package in Xcode and select the SwiftScanKit product, or declare:
.package(url: "https://github.com/chenjie1219/SwiftScanKit.git", from: "2.0.0")
CocoaPods
pod 'SwiftScanKit', '~> 2.0'
Run pod install and open the generated .xcworkspace. Both options use import SwiftScanKit.
Camera permission
Add a camera usage description to your app’s Info.plist. Scanning requires a physical device.
<key>NSCameraUsageDescription</key>
<string>Use the camera to scan QR codes and barcodes.</string>
Scanning
From a view controller with a navigation controller:
import UIKit
import SwiftScanKit
let scanner = ScannerVC()
scanner.title = "Scan"
scanner.onScan = { [weak self] code in
print(code)
self?.navigationController?.popViewController(animated: true)
}
scanner.onError = { error in
print(error.localizedDescription)
}
navigationController?.pushViewController(scanner, animated: true)
Use scanner.scanRegion = .fullScreen for full-screen scanning, or keep the default framed region. Set scanner.animationStyle = .grid for the grid animation.
Each scan returns one result and stops. To scan again on the same screen, call scanner.restartScanning().
Image generation
let qr = UIImage.generateQRCode("https://example.com", 900)
let barcode = UIImage.generateCode128("123456789", CGSize(width: 900, height: 300))
Dimensions are output pixels. Both methods return an optional UIImage.
Demo
Open SwiftScanKit.xcodeproj and run the SwiftScanKitDemo scheme to try scanning styles and image generation.
License
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…