Guest User

Untitled

a guest
Dec 13th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. let string = "tempValue&123"
  2. let data = string.data(using: String.Encoding.ascii, allowLossyConversion: false)
  3. guard let data = data else {
  4. return nil
  5. }
  6.  
  7. let descriptor = CIDataMatrixCodeDescriptor(payload: data, rowCount: 1, columnCount: 1, eccVersion: CIDataMatrixCodeDescriptor.ECCVersion(rawValue: 0))
  8. let inputParameter = ["inputBarcodeDescriptor": descriptor]
  9. let datafilter = CIFilter(name: "CIBarcodeGenerator", parameters: inputParameter)
  10. let image = datafilter?.outputImage
  11. print(image)
Add Comment
Please, Sign In to add comment