Closed chetanfaris closed 8 years ago
You can use the following code to generate EAN family barcode
let gen = RSUnifiedCodeGenerator.shared
let image: UIImage? = gen.generateCode(contents, machineReadableCodeObjectType: AVMetadataObjectTypeEAN8Code) // AVMetadataObjectTypeEAN13Code, RSBarcodesTypeISBN13Code, RSBarcodesTypeISSN13Code
isValid is designed to make sure the user input is correct before generating the barcode
isValid is designed to make sure the user input is correct before generating the barcode
@yeahdongcn: Makes sense.
However, it would be useful to be able to use isValid
without having to generate a UIImage
. For instance, it'd be handy to be able to validate a bar code String
before sending it up to a server.
If this is something you'd rather not support though, I understand 😀. If it is, and you'd like a PR, I can try to take a crack at it - please let me know.
I can add one method in RSUnifiedCodeGenerator, one PR is welcomed.
Could you take a look at the new commit, I just add a new class for this.
Works great, thank you for the fast response! Filed #52 to add this functionality to README.
Would be even more phenomenal if you could do a release :smile:.
No problem, give me two hours to finish a helper method.
Thanks @yeahdongcn!
The isValid function is not accessible because the class cannot be initialised. Is there any reason why the init method is not public?
Thanks Chetan