Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.32 KB

README.md

File metadata and controls

47 lines (31 loc) · 1.32 KB

SwiftUI Code39

SwiftUI Code39 is a Swift package that provides an easy way to generate Code 39 barcodes in your SwiftUI applications.

Installation

To use SwiftUI Code39 in your project:

  1. Xcode > File > Add Package Dependencies
  2. Add https://github.com/jiahan-wu/swiftui-code39.git
  3. Select "Up to Next Major Version" with "1.0.0"

Then, import the package in your Swift code:

import Code39

Usage

To generate a Code 39 barcode, simply create a Code39View and provide the desired content as a string:

struct ContentView: View {
    var body: some View {
        Code39View("HELLO WORLD")
            .frame(width: 296, height: 96)
    }
}

Important Note

It is the responsibility of the library user to ensure that the content passed to Code39View consists of valid characters supported by Code 39. You can use the code39SupportedCharacters set to check if a character is supported:

let content = "HELLO"
let isValid = content.allSatisfy { code39SupportedCharacters.contains($0) }

License

SwiftUI Code39 is released under the MIT License. See the LICENSE file for more information.

Contributing

Contributions to SwiftUI Code39 are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.