我有这个代码来生成条形码:
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
}
我需要生成一个code39条形码。我还没有为Code 39找到“CICode128BarcodeGenerator”的等价物。
如何为代码39修改此代码?
谢谢
如果我正确读取Apple Documentation这些是他们编码的类型:
Aztec
CheckerBoard
Code128
ConstantColor
LenticularHalo
PDF417Barcode
Random
Starshine
Stripes
Sunbeams