BarcodeScanner alternatives and similar libraries
Based on the "Camera" category.
Alternatively, view BarcodeScanner alternatives based on common mentions on social networks and blogs.
-
ImagePicker
:camera: Reinventing the way ImagePicker works. -
YPImagePicker
๐ธ Instagram-like image picker & filters for iOS -
SCRecorder
iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing -
Fusuma
Instagram-like photo browser and a camera feature with a few line of code in Swift. -
ALCameraViewController
A camera view controller with custom image picker and image cropping. -
PBJVision
๐ธ iOS Media Capture โ features touch-to-record video, slow motion, and photography -
SwiftyCam
A Snapchat Inspired iOS Camera Framework written in Swift -
FastttCamera
Fasttt and easy camera framework for iOS with customizable filters -
TGCameraViewController
Custom camera with AVFoundation. Beautiful, light and easy to integrate with iOS projects. -
CameraManager
Simple Swift class to provide all the configurations you need to create custom camera view in your app -
LLSimpleCamera
A simple, customizable camera control - video recorder for iOS. -
Cool-iOS-Camera
A fully customisable and modern camera implementation for iOS made with AVFoundation. -
Lumina
A camera designed in Swift for easily integrating CoreML models - as well as image streaming, QR/Barcode detection, and many other features -
RSBarcodes_Swift
1D and 2D barcodes reader and generators for iOS 8 with delightful controls. Now Swift. -
CameraEngine
๐๐ท Camera engine for iOS, written in Swift, above AVFoundation. ๐ -
CameraKit-iOS
Library for iOS Camera API. Massively increase performance and ease of use within your next iOS Project. -
DKCamera
A light weight & simple & easy camera for iOS by Swift. -
JVTImageFilePicker
Easy and beautiful way for a user to pick content, files or images. Written in Objective C -
CameraBackground
Show camera layer as a background to any UIView -
ExyteMediaPicker
Customizable media picker written with SwiftUI -
TakeASelfie
An iOS framework that uses the front camera, detects your face and takes a selfie. -
RAImagePicker
๐ธ iMessage-like, Image Picker Controller Provides custom features. -
MockImagePicker
Mock UIImagePickerController for testing camera based UI in simulator
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of BarcodeScanner or a related project?
README
Description
BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience.
- [x] Barcode scanning.
- [x] State modes: scanning, processing, unauthorized, not found.
- [x] Handling of camera authorization status.
- [x] Animated focus view and custom loading indicator.
- [x] Torch mode switch.
- [x] Customizable colors, informational and error messages.
- [x] No external dependencies.
- [x] Demo project.
Table of Contents
Usage
Controller
To start capturing just instantiate BarcodeScannerViewController
, set needed
delegates and present it:
let viewController = BarcodeScannerViewController()
viewController.codeDelegate = self
viewController.errorDelegate = self
viewController.dismissalDelegate = self
present(viewController, animated: true, completion: nil)
You can also push BarcodeScannerViewController
to your navigation stack:
let viewController = BarcodeScannerViewController()
viewController.codeDelegate = self
navigationController?.pushViewController(viewController, animated: true)
Delegates
Code delegate
Use BarcodeScannerCodeDelegate
when you want to get the captured code back.
extension ViewController: BarcodeScannerCodeDelegate {
func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
print(code)
controller.reset()
}
}
Error delegate
Use BarcodeScannerErrorDelegate
when you want to handle session errors.
extension ViewController: BarcodeScannerErrorDelegate {
func scanner(_ controller: BarcodeScannerViewController, didReceiveError error: Error) {
print(error)
}
}
Dismissal delegate
Use BarcodeScannerDismissalDelegate
to handle "Close button" tap.
Please note that BarcodeScannerViewController
doesn't dismiss itself if
it was presented initially.
extension ViewController: BarcodeScannerDismissalDelegate {
func scannerDidDismiss(_ controller: BarcodeScannerViewController) {
controller.dismiss(animated: true, completion: nil)
}
}
Actions
When the code is captured BarcodeScannerViewController
switches to the processing
mode:
While the user sees a nice loading animation you can perform some background task, for example make a network request to fetch product info based on the code. When the task is done you have 3 options to proceed:
- Dismiss
BarcodeScannerViewController
and show your results.
func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
// Code processing
controller.dismiss(animated: true, completion: nil)
}
- Show an error message and switch back to the scanning mode (for example, when there is no product found with a given barcode in your database):
func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
// Code processing
controller.resetWithError(message: "Error message")
// If message is not provided the default message will be used instead.
}
- Reset the controller to the scanning mode (with or without animation):
func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
// Code processing
controller.reset(animated: true)
}
If you want to do continuous barcode scanning just set the isOneTimeSearch
property on your BarcodeScannerViewController
instance to false
.
Customization
We styled BarcodeScanner to make it look nice, but you can always use public properties or inheritance to customize its appearance.
Header
let viewController = BarcodeScannerViewController()
viewController.headerViewController.titleLabel.text = "Scan barcode"
viewController.headerViewController.closeButton.tintColor = .red
Please note that HeaderViewController
is visible only when
BarcodeScannerViewController
is being presented.
Footer and messages
let viewController = BarcodeScannerViewController()
viewController.messageViewController.regularTintColor = .black
viewController.messageViewController.errorTintColor = .red
viewController.messageViewController.textLabel.textColor = .black
Camera
let viewController = BarcodeScannerViewController()
// Change focus view style
viewController.cameraViewController.barCodeFocusViewType = .animated
// Show camera position button
viewController.cameraViewController.showsCameraButton = true
// Set the initial camera position
viewController.cameraViewController.initialCameraPosition = .front // Default is .back
// Set settings button text
let title = NSAttributedString(
string: "Settings",
attributes: [.font: UIFont.boldSystemFont(ofSize: 17), .foregroundColor : UIColor.white]
)
viewController.cameraViewController.settingButton.setAttributedTitle(title, for: UIControlState())
Metadata
// Add extra metadata object type
let viewController = BarcodeScannerViewController()
viewController.metadata.append(AVMetadataObject.ObjectType.qr)
Installation
BarcodeScanner is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BarcodeScanner'
Don't forget to set a Privacy - Camera Usage Description
in your Info.plist file, else the app will crash with a SIGBART.
In order to quickly try the demo project of a BarcodeScanner just run
pod try BarcodeScanner
in your terminal.
BarcodeScanner is also available through Carthage. To install just write into your Cartfile:
github "hyperoslo/BarcodeScanner"
To install BarcodeScanner manually just download and drop Sources
and
Images
folders in your project.
Author
Hyper Interaktiv AS, [email protected]
Contributing
We would love you to contribute to BarcodeScanner, check the CONTRIBUTING file for more info.
License
BarcodeScanner is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the BarcodeScanner README section above
are relevant to that project's source code only.