
Barcode Capture Ios
Migrate or implement iOS barcode scanning using Scandit Barcode Capture instead of raw AVFoundation metadata output.
Overview
barcode-capture-ios is an agent skill for the Build phase that guides migrating iOS AVFoundation barcode scanning to Scandit Barcode Capture.
Install
npx skills add https://github.com/scandit/skills --skill barcode-capture-iosWhat is this skill?
- Fixture pattern: AVFoundation AVCaptureSession + AVCaptureMetadataOutput scanner as migration source
- Targets Scandit BarcodeCapture as the replacement capture stack on iOS
- Covers session start/stop on appear/disappear and camera input wiring
- Models scanned results as value + symbology for downstream agent refactors
- UIKit-based ViewController structure agents can rewrite toward SDK APIs
Adoption & trust: 1 installs on skills.sh; 12 GitHub stars; trending (+100% hot-view momentum).
What problem does it solve?
Your iOS app still uses AVFoundation metadata scanning and you need a disciplined path to Scandit’s capture APIs without rewriting blind.
Who is it for?
Indie iOS devs adopting Scandit or running agent-assisted SDK migrations from AVCaptureMetadataOutput.
Skip if: Android scanning, server-side barcode APIs, or apps that only need occasional photo-based QR decode without a live camera module.
When should I use this skill?
When migrating or implementing iOS barcode scanning with Scandit Barcode Capture from an AVFoundation-based scanner fixture.
What do I get? / Deliverables
Your agent refactors the fixture-style ViewController toward BarcodeCapture with preserved lifecycle and scan result handling.
- BarcodeCapture-based capture setup replacing metadata-output flow
- ViewController lifecycle and scan result pipeline aligned with SDK patterns
Recommended Skills
Journey fit
How it compares
SDK integration skill for on-device capture—not a web ZXing snippet or a generic ‘add camera permission’ checklist.
Common Questions / FAQ
Who is barcode-capture-ios for?
Solo builders and small teams shipping UIKit or SwiftUI-hosted iOS apps who want agent help moving from Apple’s metadata output to Scandit Barcode Capture.
When should I use barcode-capture-ios?
In the Build frontend subphase while implementing or migrating in-app barcode scanning, camera preview, and scan result handling on iPhone/iPad.
Is barcode-capture-ios safe to install?
Check the Security Audits panel on this page; the skill implies camera access and third-party SDK binaries—review Scandit licensing and app privacy strings yourself.
SKILL.md
READMESKILL.md - Barcode Capture Ios
// // AVFoundationViewController.swift // // Source fixture: AVFoundation AVCaptureMetadataOutput-based barcode scanner. // Used as input for third-party-migration eval — migrate this to BarcodeCapture. // import UIKit import AVFoundation struct ScannedBarcode { let value: String let symbology: String } class ViewController: UIViewController { private let session = AVCaptureSession() private var previewLayer: AVCaptureVideoPreviewLayer! private(set) var scannedBarcodes: [ScannedBarcode] = [] @IBOutlet weak var resultLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() setupCamera() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if !session.isRunning { DispatchQueue.global(qos: .userInitiated).async { self.session.startRunning() } } } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) if session.isRunning { session.stopRunning() } } private func setupCamera() { guard let videoDevice = AVCaptureDevice.default(for: .video), let videoInput = try? AVCaptureDeviceInput(device: videoDevice), session.canAddInput(videoInput) else { print("Camera not available") return } session.addInput(videoInput) let metadataOutput = AVCaptureMetadataOutput() guard session.canAddOutput(metadataOutput) else { print("Cannot add metadata output") return } session.addOutput(metadataOutput) metadataOutput.setMetadataObjectsDelegate(self, queue: .main) metadataOutput.metadataObjectTypes = [.ean13, .code128, .qr] previewLayer = AVCaptureVideoPreviewLayer(session: session) previewLayer.frame = view.layer.bounds previewLayer.videoGravity = .resizeAspectFill view.layer.addSublayer(previewLayer) } } extension ViewController: AVCaptureMetadataOutputObjectsDelegate { func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { guard let readable = metadataObjects.first as? AVMetadataMachineReadableCodeObject, let value = readable.stringValue else { return } let symbology = readable.type.rawValue let alreadyScanned = scannedBarcodes.contains { $0.value == value } guard !alreadyScanned else { return } let entry = ScannedBarcode(value: value, symbology: symbology) scannedBarcodes.append(entry) resultLabel.text = "Last scan: \(value) (\(scannedBarcodes.count) total)" } } import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } } import UIKit import ScanditBarcodeCapture class ViewController: UIViewController { private lazy var context: DataCaptureContext = { DataCaptureContext.initialize(licenseKey: "-- ENTER YOUR SCANDIT LICENSE KEY HERE --") return DataCaptureContext.shared }() private var camera: Camera? private var barcodeCapture: BarcodeCapture! private var captureView: DataCaptureView! private var overlay: BarcodeCaptureOverlay! override func viewDidLoad() { super.viewDidLoad() camera = Camera.default camera?.apply(BarcodeCapture.recommendedCameraSettings) context.setFrameSource(camera) let settings = BarcodeCaptureSettings() settings.set(symbology: .ean13UPCA, enabled: true) settings.set(symbology: .code128, enabled: true) barcodeCapture = BarcodeCapture(context: context, settings: settings) barcodeCapture.addListener(self) captureView = DataCaptureView(context: context, frame: view.bounds) captureView.au