How to generate 128C barcode in Swift 4?

919 Views Asked by At

I Need to Generate Barcode in 128C format. I searched alot but could only find 128 type Barcodes. Now I am using this code to generate Barcode and it's generating 128, but client's requirements are 128C.

   func generateQRCode(from string: String) -> UIImage? {
        let data = string.data(using: String.Encoding.ascii)
        if let filter = CIFilter(name: "CICode128BarcodeGenerator") {
            filter.setValue(data, forKey: "inputMessage")
            let transform = CGAffineTransform(scaleX: 5.0, y: 5.0)
            if let output = filter.outputImage?.transformed(by: transform) {
                return UIImage(ciImage: output)
            }
        }
        return nil
    }

Is it possible to generate 128C type barcode in iOS?

1

There are 1 best solutions below

0
On

After searched GitHub I found that code : https://github.com/yeahdongcn/RSBarcodes_Swift