{"id":19145718,"url":"https://github.com/xremix/swiftgs1barcode","last_synced_at":"2025-05-07T02:01:45.055Z","repository":{"id":47010965,"uuid":"95429648","full_name":"xremix/SwiftGS1Barcode","owner":"xremix","description":"A GS1 Barcode Library and Parser in Swift","archived":false,"fork":false,"pushed_at":"2023-06-30T18:53:00.000Z","size":168,"stargazers_count":30,"open_issues_count":2,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T16:45:51.892Z","etag":null,"topics":["barcode","barcode-api","cocoapods","gs1","ios","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xremix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-26T09:16:55.000Z","updated_at":"2024-06-25T11:08:45.000Z","dependencies_parsed_at":"2024-11-09T07:42:17.328Z","dependency_job_id":null,"html_url":"https://github.com/xremix/SwiftGS1Barcode","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xremix%2FSwiftGS1Barcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xremix%2FSwiftGS1Barcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xremix%2FSwiftGS1Barcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xremix%2FSwiftGS1Barcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xremix","download_url":"https://codeload.github.com/xremix/SwiftGS1Barcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252798833,"owners_count":21805882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","barcode-api","cocoapods","gs1","ios","swift"],"created_at":"2024-11-09T07:42:13.438Z","updated_at":"2025-05-07T02:01:45.032Z","avatar_url":"https://github.com/xremix.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftGS1Barcode\nA GS1 Barcode Library and Parser written in Swift\n\n[![Badge w/ Version](https://cocoapod-badges.herokuapp.com/v/SwiftGS1Barcode/badge.png)](https://cocoadocs.org/docsets/SwiftGS1Barcode)\n[![Language](https://img.shields.io/badge/language-swift%205-1b7cb9.svg)](https://img.shields.io/badge/language-swift%205-1b7cb9.svg)\n[![iOS](https://img.shields.io/badge/iOS-8.0%2B-1b7cb9.svg)](https://img.shields.io/badge/iOS-9.0%2B-1b7cb9.svg)\n[![macOS](https://img.shields.io/badge/macOS-Yes-1b7cb9.svg)](https://img.shields.io/badge/iOS-9.0%2B-1b7cb9.svg)\n[![Linux](https://img.shields.io/badge/Linux-Yes-1b7cb9.svg)](https://img.shields.io/badge/iOS-9.0%2B-1b7cb9.svg)\n[![Code Coverage](https://img.shields.io/badge/Code%20Coverage-97%25-green.svg)](https://img.shields.io/badge/Code%20Coverage-97%25-green.svg)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/xremix/SwiftGS1Barcode/master/LICENSE)\n[![Build Status](https://travis-ci.org/xremix/SwiftGS1Barcode.svg?branch=master)](https://travis-ci.org/xremix/SwiftGS1Barcode)\n\nA Library to parse GS1 Barcode strings into a object and allows an easy access to the properties that a GS1 Barcode can have.  \nSupported is a large set of common Application Identifiers (GS1 Barcodes), but it can be easily extended on the fly to support any identifier needed.\n\n**Contributions are most welcome.**\n\nYou can also find this project on [CocoaPods](https://cocoapods.org/pods/SwiftGS1Barcode) or can use Swift Package Manager.\n\n**CocoaPods** currently might be out of date. Please compare with latest version of the git tags.\n\n## Getting started\nParsing is as simple as\n\n```Swift\nimport SwiftGS1Barcode\n// ...\nlet gs1Barcode = \"01101234670417283002\\u{1D}1721103110S123456\"\nlet barcode = GS1Barcode(raw: gs1Barcode)\nbarcode.validate() // To check if you barcode is valid\n\nprint(barcode.gtin) // 10123467041728\nprint(barcode.countOfItems) // 2\nprint(barcode.expirationDate) // 31.10.2021\nprint(barcode.lotNumber) // S123456\n```\n#### Advanced Usage\n\nTo seperate the parsing from initializing I'd recommend a code like\n\n```Swift\nimport SwiftGS1Barcode\n// ...\nlet gs1BarcodeText = \"01101234670417283002\\u{1D}1721103110S123456\"\nlet barcode = GS1Barcode()\nbarcode.raw = gs1BarcodeText\n_ = barcode.parse()\n```\n\nTo parse **custom Application Identifiers** use the following code\n\n```Swift\nimport SwiftGS1Barcode\n// ...\nlet gs1BarcodeText = \"90HelloWorld\\u{1D}01101234670417283002\\u{1D}1721103110S123456\"\nlet barcode = GS1Barcode()\nbarcode.applicationIdentifiers[\"custom1\"] = GS1ApplicationIdentifier(\"90\", length: 30, type: .String, dynamicLength: true)\nbarcode.raw = gs1BarcodeText\n_ = barcode.parse()\nprint(barcode.applicationIdentifiers[\"custom1\"]!.stringValue)\n```\nTo see some samples, of how to set up Application Identifiers check out the [GS1Barcode Class](https://github.com/xremix/SwiftGS1Barcode/blob/master/SwiftGS1Barcode/GS1Barcode.swift#L19)\n\n### Available Properties\nThe following properties are currently supported:\n\n\n| ID | Application Identifier | Experimental Support |\n|----|:-------------:|:-------------:|\n| 00 | serialShippingContainerCode | No |\n| 01 | gtin | No |\n| 02 | gtinOfContainedTradeItems | No |\n| 10 | lotNumber | No |\n| 11 | productionDate | No |\n| 12 | dueDate | No |\n| 13 | packagingDate | No |\n| 15 | bestBeforeDate | No |\n| 17 | expirationDate | No |\n| 20 | productVariant | No |\n| 21 | serialNumber | No |\n| 22 | secondaryDataFields | No |\n| 30 | countOfItems | No |\n| 37 | numberOfUnitsContained | No |\n| 310 | productWeightInKg | No |\n| 240 | additionalProductIdentification | No |\n| 241 | customerPartNumber | No |\n| 242 | madeToOrderVariationNumber | No |\n| 250 | secondarySerialNumber | No |\n| 251 | referenceToSourceEntity | No |\n| 392 | priceSingleMonetaryArea | No |\n| 393 | priceAndISO | No |\n| 395 | pricePerUOM | No |\n| 422 | countryOfOrigin | No |\n| 714 | nhrnAIM | No |\n\n\n*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.*\n\nYou can add custom application identifiers by adding them to the key / value dictionary:\n```Swift\nlet barcode = GS1Barcode()\nbarcode.applicationIdentifiers[\"custom1\"] = GS1ApplicationIdentifier(\"90\", length: 30, type: .String, dynamicLength: true)\n```\nThey'll automatically get parsed by the `parse()` function.  \n**You can also simply contribute by yourself and add them to the `GS1BarcodeParser.swift` class**, or open an [issue](https://github.com/xremix/SwiftGS1Barcode/issues/new) if there is something missing for you.\n\n## Installation\n\n### Swift Package Manager (recommended)\n\nOpen your project and Xcode and click *File -\u003e Swift Packages -\u003e Add Package Dependency* and enter `git@github.com:xremix/SwiftGS1Barcode.git`\n\n### CocoaPods\nYou can install [the library](https://cocoapods.org/pods/SwiftGS1Barcode) to your project by using [CocoaPods](https://cocoapods.org). Add the following code to your `Podfile`:\n```\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n\tpod 'SwiftGS1Barcode'\nend\n```\nAlternative you can also add the direct Github source (or a different branch):\n```\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n\tpod 'SwiftGS1Barcode', :git =\u003e 'https://github.com/xremix/SwiftGS1Barcode', :branch =\u003e 'master'\nend\n```\n\n### Manually\nYou can add the project as a git `submodule`. Simply drag the `SwiftGS1Barcode.xcodeproj` file into your Xcode project.  \n**Don't forget to add the framework in your application target**\n\n## Resources\nA couple of resources, used for this project.\n\n#### GS1 parsing\nhttps://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf\nhttps://www.activebarcode.de/codes/ean128_ucc128_ai.html\nhttps://www.gs1.at/fileadmin/user_upload/Liste_GS1_Austria_Application_Identifier.pdf\n\n#### CocoaPod\nhttps://www.appcoda.com/cocoapods-making-guide/\n\n\n![Analytics](https://ga-beacon.appspot.com/UA-40522413-9/SwiftGS1Barcode/readme?pixel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxremix%2Fswiftgs1barcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxremix%2Fswiftgs1barcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxremix%2Fswiftgs1barcode/lists"}