A GS1 Barcode Library and Parser written in Swift
Parsing is as simple as
let gs1Barcode = "01101234670417283002\u{1D}1721103110S123456"
let barcode = GS1Barcode(raw: gs1Barcode)
print(barcode.gtin)
print(barcode.amount)
print(barcode.expirationDate)
print(barcode.lotNumber)
Currently only the following properties are available and do get parsed
GTIN
GtinIndicatorDigit
lotNumber
expirationDate
serialNumber
amount
Other properties can be extended pretty easily. You can contribute yourself, or open an issue.
You can install the library to you project using CocoaPods. Add the following code to your Podfile
:
pod 'SwiftGS1Barcode'
Alternative you can also add the direct Github URL:
pod 'SwiftGS1Barcode', :git => 'https://github.com/xremix/SwiftGS1Barcode', :branch => 'master'
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 *
- Run Unit Tests
- Lint Podfile using
pod lib lint
- Update Version in
Project Settings
andPod Specs
- Push Code to Git
- Create Release on Git
- Push code to CocoaPods using
pod trunk push SwiftGS1Barcode.podspec
A couple of resources, used for this project.
https://www.activebarcode.de/codes/ean128_ucc128_ai.html https://www.gs1.at/fileadmin/user_upload/Liste_GS1_Austria_Application_Identifier.pdf