Latest | 0.17.0 |
---|---|
Homepage | https://github.com/hanzhe94/iZyooRecognizer |
License | MIT |
Platforms | ios 11.0, requires ARC |
Dependencies | Firebase/Core, Firebase/Auth, Firebase/MLVision, Firebase/MLVisionTextModel |
Authors |
This is a delightful component for quick and easy scanning documents for your iOS app, documents included:
- [x] Malaysia Identity Card
- [x] Malaysia Driving Licence
- [x] Singapore Identity Card
- [x] Singapore Driving Licence
- [x] Passport
- [x] QR
Requirements
The framework can be deployed in iOS 11.0 or later
Install via CocoaPods
Add to your Podfile
:
pod 'iZyooRecognizer'
Code
Before adding our camera related code, make sure you include the permissions needed for your code to work in the app project Info.plist file:
<key>NSCameraUsageDescription</key>
<string></string>
Example Usage – Objective-C
Set Always Embed Swift Standard Libraries
to Yes
#import <iZyooRecognizer/iZyooRecognizer-Swift.h>
iZyooRecognizerSettings *settings = [[iZyooRecognizerSettings alloc] init];
settings.documentTypes = @[DocumentType.MalaysiaIdentityCard,
DocumentType.MalaysiaDrivingLicence,
DocumentType.SingaporeIdentityCard,
DocumentType.SingaporeDrivingLicence,
DocumentType.Passport,
DocumentType.QR];
iZyooRecognizer *recognizer = [iZyooRecognizer shared];
[recognizer run:settings :self
success:^(DocumentType * _Nonnull type, NSDictionary<NSString *,id> * _Nonnull result) {
if(type == DocumentType.MalaysiaIdentityCard){
MalaysiaIdentityCard *data = [[MalaysiaIdentityCard alloc] init:result];
}
else if(type == DocumentType.MalaysiaDrivingLicence){
MalaysiaDrivingLicence *data = [[MalaysiaDrivingLicence alloc] init:result];
}
else if(type == DocumentType.SingaporeIdentityCard){
SingaporeIdentityCard *data = [[SingaporeIdentityCard alloc] init:result];
}
else if(type == DocumentType.SingaporeDrivingLicence){
SingaporeDrivingLicence *data = [[SingaporeDrivingLicence alloc] init:result];
}
else if(type == DocumentType.Passport){
Passport *data = [[Passport alloc] init:result];
}
else if(type == DocumentType.QR){
QR *data = [[QR alloc] init:result];
}
} failed:^(NSInteger errorCode) {
NSLog(@"ERROR CODE: %ld", (long)errorCode);
}];
Example Usage – Swift
import iZyooRecognizer
let settings = iZyooRecognizerSettings()
settings.documentTypes = [.MalaysiaIdentityCard,
.MalaysiaDrivingLicence,
.SingaporeIdentityCard,
.SingaporeDrivingLicence,
.Passport,
.QR]
let recognizer = iZyooRecognizer.shared()
recognizer.run(settings, self, success: { (type, result) in
print(result)
if type == .MalaysiaIdentityCard{
let data = MalaysiaIdentityCard(result)
}
else if type == .MalaysiaDrivingLicence{
let data = MalaysiaDrivingLicence(result)
}
else if type == .SingaporeIdentityCard{
let data = SingaporeIdentityCard(result)
}
else if type == .SingaporeDrivingLicence{
let data = SingaporeDrivingLicence(result)
}
else if type == .Passport{
let data = Passport(result)
}
else if type == .QR{
let data = QR(result)
}
}) { (error) in
print("error: (error) : (error.rawValue)")
}
}
Customize Field – Objective-C
iZyooRecognizerSettings *settings = [[iZyooRecognizerSettings alloc] init];
settings.qos = QoSMedium;
settings.autoFrame = YES;
settings.timeout = 10;
settings.overlayTextColor = [UIColor greenColor];
Customize Field – Swift
let settings = iZyooRecognizerSettings()
settings.qos = .medium
settings.autoFrame = true
settings.timeout = 10
settings.overlayTextColor = UIColor.green
Variable | Options | Description |
---|---|---|
settings.qos | .high .medium .low |
Scan accuracy |
settings.autoFrame | true or false |
Auto detect rectangle |
settings.timeout | 0 to 60 | Timed out will show a button at below to allow manual capture, 0 = infinite scan |
settings.overlayTextColor | UIColor | Text color of overylay text |
Add Watermark – Text – Objective-C
iZyooWatermarkText *watermarkText = [[iZyooWatermarkText alloc] init];
watermarkText.text = @"12345";
watermarkText.textColor = [UIColor greenColor];
watermarkText.rotate = RotateLeft;
watermarkText.alpha = 0.5;
iZyooRecognizerSettings *settings = [[iZyooRecognizerSettings alloc] init];
[settings addWatermarkWithText:watermarkText];
Add Watermark – Text – Swift
let watermarkText = iZyooWatermarkText()
watermarkText.text = "12345"
watermarkText.textColor = UIColor.green
watermarkText.rotate = .left
watermarkText.alpha = 0.5
let settings = iZyooRecognizerSettings()
settings.addWatermark(settings: watermarkText)
Variable | Options |
---|---|
watermarkText.text | String |
watermarkText.textColor | UIColor |
watermarkText.rotate | .none .left .right |
watermarkText.alpha | CGFloat, 0.0 to 1.0 |
Add Watermark – Image – Objective-C
iZyooWatermarkImage *watermarkImage = [[iZyooWatermarkImage alloc] init];
watermarkImage.image = [UIImage imageNamed:@"123"];
watermarkImage.contentMode = UIViewContentModeBottomRight;
watermarkImage.alpha = 0.5;
iZyooRecognizerSettings *settings = [[iZyooRecognizerSettings alloc] init];
[settings addWatermarkWithImage:watermarkImage];
Add Watermark – Image – Swift
let watermarkImage = iZyooWatermarkImage()
watermarkImage.image = UIImage(named: "123")!
watermarkImage.contentMode = UIView.ContentMode.bottomRight
watermarkImage.alpha = 0.5
let settings = iZyooRecognizerSettings()
settings.addWatermark(settings: watermarkImage)
Variable | Options |
---|---|
watermarkImage.image | UIImage |
watermarkImage.contentMode | UIViewContentMode |
watermarkImage.alpha | CGFloat, 0.0 to 1.0 |
Malaysia Identity Card
MalaysiaIdentityCard *data = [[MalaysiaIdentityCard alloc] init:result];
let data = MalaysiaIdentityCard(result)
Variable | Data Type | Example | Format |
---|---|---|---|
data.nric | String | 920221-08-7395 | xxxxxx-xx-xxxx |
data.dob | String | 920221 | yyMMdd |
data.gender | String | M or F |
|
data.name | String | Chieng Yew Jeu | |
data.street | String | N-67-37, Jalan Imbi 1/8, Apartment Angkasa | |
data.postcode | String | 36000 | |
data.city | String | Teluk Intan | |
data.state | String | Perak | |
data.full_image | UIImage |
Malaysia Driving Licence
MalaysiaDrivingLicence *data = [[MalaysiaDrivingLicence alloc] init:result];
let data = MalaysiaDrivingLicence(result)
Variable | Data Type | Example | Format |
---|---|---|---|
data.nric | String | 920221087395 | xxxxxxxxxxxx |
data.dob | String | 920221 | yyMMdd |
data.gender | String | M or F |
|
data.name | String | Chieng Yew Jeu | |
data.street | String | N-67-37, Jalan Imbi 1/8, Apartment Angkasa | |
data.postcode | String | 36000 | |
data.city | String | Teluk Intan | |
data.state | String | Perak | |
data.classes | Array |
B2, D | |
data.issue_date | String | 01022017 | ddMMyyyy |
data.expiry_date | String | 01022018 | ddMMyyyy |
data.full_image | UIImage |
Singapore Identity Card
SingaporeIdentityCard *data = [[SingaporeIdentityCard alloc] init:result];
let data = SingaporeIdentityCard(result)
Variable | Data Type | Example | Format |
---|---|---|---|
data.nric | String | S7933924E | |
data.name | String | Chieng Yew Jeu | |
data.race | String | CHINESE | |
data.dob | String | 16-11-1979 | dd-MM-yyyy |
data.gender | String | M or F |
|
data.country_of_birth | String | SINGAPORE | |
data.full_image | UIImage |
Singapore Driving Licence
SingaporeDrivingLicence *data = [[SingaporeDrivingLicence alloc] init:result];
let data = SingaporeDrivingLicence(result)
Variable | Data Type | Example | Format |
---|---|---|---|
data.licence_number | String | S9025671H | |
data.name | String | Chieng Yew Jeu | |
data.dob | String | 25Jul1990 | ddMMMyyyy |
data.issue_date | String | 30Apr2019 | ddMMMyyyy |
data.full_image | UIImage |
Passport
Passport *data = [[Passport alloc] init:result];
let data = Passport(result)
Variable | Data Type | Example | Format |
---|---|---|---|
data.passport_number | String | H36488362 | |
data.name | String | Chieng Yew Jeu | |
data.gender | String | M or F or non-specified |
|
data.dob | String | 931014 | yyMMdd |
data.country.name | String | Malaysia | |
data.country.alpha2 | String | MY | |
data.country.alpha3 | String | MYS | |
data.expiry_date | String | 201215 | yyMMdd |
data.full_image | UIImage |
QR
QR *data = [[QR alloc] init:result];
let data = QR(result)
Variable | Data Type | Example |
---|---|---|
data.value | String | 12345 |
iZyooRecognizerError
Error Code | Name | Description |
---|---|---|
10 | cameraAccessDenied | Camera access denied, please allow camera access. |
20 | emptyDocumentType | Document type empty, please insert at least one document type. |
30 | invalidTimeout | Invalid timeout entered, range only allow 0 to 60, 0 is infinity scan. |
40 | invalidWatermarkImage | Invalid Watermark Image. |
Latest podspec
{ "name": "iZyooRecognizer", "platforms": { "ios": "11.0" }, "summary": "iZyooRecognizer lets a user to capture their MyKad or Passport", "requires_arc": true, "version": "0.17.0", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "Derek": "[email protected]" }, "homepage": "https://github.com/hanzhe94/iZyooRecognizer", "source": { "git": "https://github.com/hanzhe94/iZyooRecognizer.git", "tag": "0.17.0" }, "dependencies": { "Firebase/Core": [], "Firebase/Auth": [], "Firebase/MLVision": [], "Firebase/MLVisionTextModel": [] }, "swift_versions": "4", "ios": { "vendored_frameworks": "iZyooRecognizer.framework" }, "swift_version": "4" }
Sun, 09 Jun 2019 10:09:05 +0000