Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Source Link
jbrown94305
  • 185
  • 2
  • 12

Generate Code 39 Barcode

I have this code to generate a barcode:

func generateBarcode(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: 3, y: 3) if let output = filter.outputImage?.transformed(by: transform) { return UIImage(ciImage: output) } } return nil } 

I need to generate a code39 barcode. I have not found an equivalent for "CICode128BarcodeGenerator" for Code 39.

How can I modify this code for code 39?

thanks