All Projects → xremix → SwiftGS1Barcode

xremix / SwiftGS1Barcode

Licence: MIT license
A GS1 Barcode Library and Parser in Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to SwiftGS1Barcode

Bark-JS
🔬 Parse barcode inputs 🏷️ in a unified GS1-128 format 📦🌐
Stars: ✭ 18 (-18.18%)
Mutual labels:  barcode, gs1
epcis
.NET 5 implementation of GS1's EPCIS repository version 1.2
Stars: ✭ 20 (-9.09%)
Mutual labels:  gs1
jQuery.EAN13
A jQuery & plain JavaScript library for generating EAN13-barcodes
Stars: ✭ 45 (+104.55%)
Mutual labels:  barcode
scanbot-sdk-example-ios
No description or website provided.
Stars: ✭ 17 (-22.73%)
Mutual labels:  barcode
laravel-barcode-generator
Generate multiple barcode in Laravel as well as in core PHP for your project, Very easy to install and easy to manage, no difficulties or no complexities for use, keep always smile. :)
Stars: ✭ 17 (-22.73%)
Mutual labels:  barcode
BarcodeReader
Simple multi-format barcode reader for Windows
Stars: ✭ 26 (+18.18%)
Mutual labels:  barcode
barcode-detector
Spec compliant polyfill of the Barcode Detection API 🤳
Stars: ✭ 31 (+40.91%)
Mutual labels:  barcode
barcode
No description or website provided.
Stars: ✭ 27 (+22.73%)
Mutual labels:  barcode
ESCPOS
A ESC/POS Printer Commands Helper
Stars: ✭ 26 (+18.18%)
Mutual labels:  barcode
barcode-server
Barcode Server for Barcode Client-Server android application
Stars: ✭ 40 (+81.82%)
Mutual labels:  barcode
javascript-barcode
Dynamsoft Barcode Reader JavaScript SDK for package managers. PDF417, QR Code, DataMatrix, MaxiCode and more are supported.
Stars: ✭ 142 (+545.45%)
Mutual labels:  barcode
angular-io-barcode
Angular wrapper for io-barcode
Stars: ✭ 30 (+36.36%)
Mutual labels:  barcode
inventory
Use a barcode reader to scan the foods in your house and add them to a database. See legacy for zbarcam integration. Master integrates with a USB barcode laser scanner.
Stars: ✭ 32 (+45.45%)
Mutual labels:  barcode
barcode.flutter
barcode generate library for Flutter
Stars: ✭ 58 (+163.64%)
Mutual labels:  barcode
ZxingSupport
A Library based on Zxing, make you easy to develop 1D/2D barcode-scan App.
Stars: ✭ 15 (-31.82%)
Mutual labels:  barcode
api2pdf.php
PHP client library for the Api2Pdf.com REST API - Convert HTML to PDF, URL to PDF, Office Docs to PDF, Merge PDFs, HTML to Image, URL to Image, HTML to Docx, HTML to Xlsx, PDF to HTML, Thumbnail preview of office files
Stars: ✭ 42 (+90.91%)
Mutual labels:  barcode
react-native-smart-code
Support React & ReactNative.In react-native,it's create base64 String,which is qrcode or barcode ,and without webview.In react,we use jsbarcode.
Stars: ✭ 14 (-36.36%)
Mutual labels:  barcode
glide-barcode
GlideBarcode is an open-source barcode loading extension for Android Glide that wraps barcode generating and displaying.
Stars: ✭ 24 (+9.09%)
Mutual labels:  barcode
epcis
Oliot EPCIS (Oliot EPC Information Service)
Stars: ✭ 32 (+45.45%)
Mutual labels:  gs1
escpos-coffee-samples
anastaciocintra.github.io/escpos-coffee
Stars: ✭ 29 (+31.82%)
Mutual labels:  barcode

SwiftGS1Barcode

A GS1 Barcode Library and Parser written in Swift

Badge w/ Version Language iOS macOS Linux Code Coverage GitHub license Build Status

A Library to parse GS1 Barcode strings into a object and allows an easy access to the properties that a GS1 Barcode can have.
Supported is a large set of common Application Identifiers (GS1 Barcodes), but it can be easily extended on the fly to support any identifier needed.

Contributions are most welcome.

You can also find this project on CocoaPods or can use Swift Package Manager.

Getting started

Parsing is as simple as

import SwiftGS1Barcode
// ...
let gs1Barcode = "01101234670417283002\u{1D}1721103110S123456"
let barcode = GS1Barcode(raw: gs1Barcode)
barcode.validate() // To check if you barcode is valid

print(barcode.gtin) // 10123467041728
print(barcode.countOfItems) // 2
print(barcode.expirationDate) // 31.10.2021
print(barcode.lotNumber) // S123456

Advanced Usage

To seperate the parsing from initializing I'd recommend a code like

import SwiftGS1Barcode
// ...
let gs1BarcodeText = "01101234670417283002\u{1D}1721103110S123456"
let barcode = GS1Barcode()
barcode.raw = gs1BarcodeText
_ = barcode.parse()

To parse custom Application Identifiers use the following code

import SwiftGS1Barcode
// ...
let gs1BarcodeText = "90HelloWorld\u{1D}01101234670417283002\u{1D}1721103110S123456"
let barcode = GS1Barcode()
barcode.applicationIdentifiers["custom1"] = GS1ApplicationIdentifier("90", length: 30, type: .String, dynamicLength: true)
barcode.raw = gs1BarcodeText
_ = barcode.parse()
print(barcode.applicationIdentifiers["custom1"]!.stringValue)

To see some samples, of how to set up Application Identifiers check out the GS1Barcode Class

Available Properties

The following properties are currently supported:

ID Application Identifier Experimental Support
00 serialShippingContainerCode
01 gtin
02 gtinOfContainedTradeItems
10 lotNumber (batchNumber)
11 productionDate
12 dueDate
13 packagingDate
15 bestBeforeDate
17 expirationDate
20 productVariant
21 serialNumber
22 secondaryDataFields
30 countOfItems
37 numberOfUnitsContained
310 productWeightInKG
23n lotNumberN Yes
240 additionalProductIdentification Yes
241 customerPartNumber Yes
242 madeToOrderVariationNumber Yes
250 secondarySerialNumber Yes
251 referenceToSourceEntity Yes

Experimental Support means that these are getting parsed, but there are no getter for this. You can get the value by calling e.g. myGs1Barcode.applicationIdentifiers["additionalProductIdentification"]. Also the implementation can change if any parsing issues come up.

You can add custom application identifiers by adding them to the key / value dictionary:

let barcode = GS1Barcode()
barcode.applicationIdentifiers["custom1"] = GS1ApplicationIdentifier("90", length: 30, type: .String, dynamicLength: true)

They'll automatically get parsed by the parse() function.
You can also simply contribute by yourself and add them to the GS1BarcodeParser.swift class, or open an issue if there is something missing for you.

Installation

Swift Package Manager (recommended)

Open your project and Xcode and click File -> Swift Packages -> Add Package Dependency and enter [email protected]:xremix/SwiftGS1Barcode.git

CocoaPods

You can install the library to your project by using CocoaPods. Add the following code to your Podfile:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
	pod 'SwiftGS1Barcode'
end

Alternative you can also add the direct Github source (or a different branch):

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
	pod 'SwiftGS1Barcode', :git => 'https://github.com/xremix/SwiftGS1Barcode', :branch => 'master'
end

Manually

You can add the project as a git submodule. Simply drag the SwiftGS1Barcode.xcodeproj file into your Xcode project.
Don't forget to add the framework in your application target

Resources

A couple of resources, used for this project.

GS1 parsing

https://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf https://www.activebarcode.de/codes/ean128_ucc128_ai.html https://www.gs1.at/fileadmin/user_upload/Liste_GS1_Austria_Application_Identifier.pdf

CocoaPod

https://www.appcoda.com/cocoapods-making-guide/

Analytics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].