How to use of class

Best Quick code snippet using of

MBIDExtractors.swift

Source:MBIDExtractors.swift Github

copy

Full Screen

1//2// IdExtractors.swift3// Showcase4//5// Created by Dominik Cubelic on 22/08/2018.6// Copyright © 2018 Dominik Cubelic. All rights reserved.7//8import Foundation9import MicroBlink10extension MBAustriaCombinedRecognizer {11 override func extractFieldResults() -> NSArray {12 let fields = NSMutableArray()13 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenName))14 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))15 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))16 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))17 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))18 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))19 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))20 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))21 fields.add(MBField(key: MBFieldKey.principalResidence, value: result.principalResidence))22 fields.add(MBField(key: MBFieldKey.height, value: result.height))23 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssuance))24 fields.add(MBField(key: MBFieldKey.eyeColour, value: result.eyeColour))25 return fields26 }27}28extension MBAustriaIdBackRecognizer {29 override func extractFieldResults() -> NSArray {30 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())31 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))32 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))33 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))34 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssuance))35 return fields36 }37}38extension MBAustriaIdFrontRecognizer {39 override func extractFieldResults() -> NSArray {40 let fields = NSMutableArray()41 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenName))42 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))43 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))44 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))45 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))46 return fields47 }48}49extension MBBruneiIdBackRecognizer {50 override func extractFieldResults() -> NSArray {51 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())52 53 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))54 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))55 fields.add(MBField(key: MBFieldKey.race, value: result.race))56 57 return fields58 }59}60extension MBBruneiIdFrontRecognizer {61 override func extractFieldResults() -> NSArray {62 let fields = NSMutableArray()63 64 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))65 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))66 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))67 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))68 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))69 70 return fields71 }72}73extension MBBruneiMilitaryIdBackRecognizer {74 override func extractFieldResults() -> NSArray {75 let fields = NSMutableArray()76 77 fields.add(MBField(key: MBFieldKey.armyNumber, value: result.armyNumber))78 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))79 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))80 81 return fields82 }83}84extension MBBruneiMilitaryIdFrontRecognizer {85 override func extractFieldResults() -> NSArray {86 let fields = NSMutableArray()87 88 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))89 fields.add(MBField(key: MBFieldKey.rank, value: result.rank))90 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))91 92 return fields93 }94}95extension MBColombiaIdBackRecognizer {96 override func extractFieldResults() -> NSArray {97 let fields = NSMutableArray()98 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))99 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))100 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))101 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))102 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))103 return fields104 }105}106extension MBColombiaIdFrontRecognizer {107 override func extractFieldResults() -> NSArray {108 let fields = NSMutableArray()109 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))110 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))111 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))112 return fields113 }114}115extension MBCroatiaCombinedRecognizer {116 override func extractFieldResults() -> NSArray {117 let fields = NSMutableArray()118 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))119 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))120 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))121 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))122 fields.add(MBField(key: MBFieldKey.citizenship, value: result.citizenship))123 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))124 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))125 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.residence))126 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuedBy))127 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))128 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.oib))129 return fields130 }131}132extension MBCroatiaIdBackRecognizer {133 override func extractFieldResults() -> NSArray {134 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())135 fields.add(MBField(key: MBFieldKey.residenceFullAddress, value: result.residence))136 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))137 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))138 fields.add(MBField(key: MBFieldKey.expiryDatePermanent, value: result.dateOfExpiryPermanent))139 return fields140 }141}142extension MBCroatiaIdFrontRecognizer {143 override func extractFieldResults() -> NSArray {144 let fields = NSMutableArray()145 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))146 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))147 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))148 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))149 fields.add(MBField(key: MBFieldKey.citizenship, value: result.citizenship))150 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))151 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))152 fields.add(MBField(key: MBFieldKey.expiryDatePermanent, value: result.dateOfExpiryPermanent))153 return fields154 }155}156extension MBCyprusIdBackRecognizer {157 override func extractFieldResults() -> NSArray {158 let fields = result.mrzResult.extractFieldResults()159 160 return fields161 }162}163extension MBCyprusIdFrontRecognizer {164 override func extractFieldResults() -> NSArray {165 let fields = NSMutableArray()166 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.idNumber))167 return fields168 }169}170extension MBCyprusOldIdBackRecognizer {171 override func extractFieldResults() -> NSArray {172 let fields = NSMutableArray()173 174 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))175 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))176 177 return fields178 }179}180extension MBCyprusOldIdFrontRecognizer {181 override func extractFieldResults() -> NSArray {182 let fields = NSMutableArray()183 184 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))185 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.idNumber))186 fields.add(MBField(key: MBFieldKey.firstName, value: result.name))187 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))188 189 return fields190 }191}192extension MBCzechiaCombinedRecognizer {193 override func extractFieldResults() -> NSArray {194 let fields = NSMutableArray()195 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))196 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))197 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.documentNumber))198 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))199 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))200 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))201 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))202 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))203 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.permanentStay))204 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.authority))205 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))206 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.personalNumber))207 return fields208 }209}210extension MBCzechiaIdBackRecognizer {211 override func extractFieldResults() -> NSArray {212 let fields = NSMutableArray()213 fields.add(MBField(key: MBFieldKey.authority, value: result.authority))214 fields.add(MBField(key: MBFieldKey.residenceFullAddress, value: result.permanentStay))215 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.personalNumber))216 return fields217 }218}219extension MBCzechiaIdFrontRecognizer {220 override func extractFieldResults() -> NSArray {221 let fields = NSMutableArray()222 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))223 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))224 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))225 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))226 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))227 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))228 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))229 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))230 return fields231 }232}233extension MBEgyptIdFrontRecognizer {234 override func extractFieldResults() -> NSArray {235 let fields = NSMutableArray()236 fields.add(MBField(key: MBFieldKey.nationalNumber, value: result.nationalNumber))237 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))238 return fields239 }240}241extension MBGermanyCombinedRecognizer {242 override func extractFieldResults() -> NSArray {243 let fields = NSMutableArray()244 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))245 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))246 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))247 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))248 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))249 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))250 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))251 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))252 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.documentNumber))253 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))254 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.authority))255 fields.add(MBField(key: MBFieldKey.height, value: result.height))256 fields.add(MBField(key: MBFieldKey.eyeColour, value: result.colourOfEyes))257 fields.add(MBField(key: MBFieldKey.canNumber, value: result.canNumber))258 return fields259 }260}261extension MBGermanyIdBackRecognizer {262 override func extractFieldResults() -> NSArray {263 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())264 fields.add(MBField(key: MBFieldKey.authority, value: result.authority))265 fields.add(MBField(key: MBFieldKey.city, value: result.addressCity))266 fields.add(MBField(key: MBFieldKey.addressStreet, value: result.addressStreet))267 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.fullAddress))268 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))269 return fields270 }271}272extension MBGermanyIdFrontRecognizer {273 override func extractFieldResults() -> NSArray {274 let fields = NSMutableArray()275 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))276 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))277 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))278 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))279 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))280 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))281 fields.add(MBField(key: MBFieldKey.canNumber, value: result.canNumber))282 return fields283 }284}285extension MBGermanyIdOldRecognizer {286 override func extractFieldResults() -> NSArray {287 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())288 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))289 return fields290 }291}292extension MBHongKongIdFrontRecognizer {293 override func extractFieldResults() -> NSArray {294 let fields = NSMutableArray()295 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))296 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))297 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))298 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))299 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))300 fields.add(MBField(key: MBFieldKey.residentialStatus, value: result.residentialStatus))301 return fields302 }303}304extension MBIndonesiaIdFrontRecognizer {305 override func extractFieldResults() -> NSArray {306 let fields = NSMutableArray()307 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))308 fields.add(MBField(key: MBFieldKey.province, value: result.province))309 fields.add(MBField(key: MBFieldKey.city, value: result.city))310 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))311 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))312 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))313 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))314 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))315 fields.add(MBField(key: MBFieldKey.religion, value: result.religion))316 fields.add(MBField(key: MBFieldKey.maritalStatus, value: result.maritalStatus))317 fields.add(MBField(key: MBFieldKey.occupation, value: result.occupation))318 fields.add(MBField(key: MBFieldKey.citizenship, value: result.citizenship))319 return fields320 }321}322extension MBJordanCombinedRecognizer {323 override func extractFieldResults() -> NSArray {324 let fields = NSMutableArray()325 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))326 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))327 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))328 fields.add(MBField(key: MBFieldKey.nationalNumber, value: result.nationalNumber))329 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))330 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))331 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))332 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))333 return fields334 }335}336extension MBJordanIdBackRecognizer {337 override func extractFieldResults() -> NSArray {338 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())339 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))340 return fields341 }342}343extension MBJordanIdFrontRecognizer {344 override func extractFieldResults() -> NSArray {345 let fields = NSMutableArray()346 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))347 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))348 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))349 fields.add(MBField(key: MBFieldKey.nationalNumber, value: result.nationalNumber))350 return fields351 }352}353extension MBKuwaitIdBackRecognizer {354 override func extractFieldResults() -> NSArray {355 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())356 fields.add(MBField(key: MBFieldKey.serialNo, value: result.serialNo))357 return fields358 }359}360extension MBKuwaitIdFrontRecognizer {361 override func extractFieldResults() -> NSArray {362 let fields = NSMutableArray()363 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))364 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))365 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))366 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.expiryDate))367 fields.add(MBField(key: MBFieldKey.civilIdNumber, value: result.civilIdNumber))368 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))369 return fields370 }371}372extension MBMalaysiaIkadFrontRecognizer {373 override func extractFieldResults() -> NSArray {374 let fields = NSMutableArray()375 376 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))377 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))378 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))379 fields.add(MBField(key: MBFieldKey.sex, value: result.gender))380 fields.add(MBField(key: MBFieldKey.sector, value: result.sector))381 fields.add(MBField(key: MBFieldKey.employer, value: result.employer))382 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))383 fields.add(MBField(key: MBFieldKey.facultyAddress, value: result.facultyAddress))384 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))385 386 return fields387 }388}389extension MBMalaysiaMyKadBackRecognizer {390 override func extractFieldResults() -> NSArray {391 let fields = NSMutableArray()392 393 fields.add(MBField(key: MBFieldKey.nricNumber, value: result.nric))394 fields.add(MBField(key: MBFieldKey.oldNric, value: result.oldNric))395 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))396 397 return fields398 }399}400extension MBMalaysiaMyKadFrontRecognizer {401 override func extractFieldResults() -> NSArray {402 let fields = NSMutableArray()403 404 fields.add(MBField(key: MBFieldKey.nricNumber, value: result.nric))405 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.fullAddress))406 fields.add(MBField(key: MBFieldKey.city, value: result.city))407 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))408 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))409 fields.add(MBField(key: MBFieldKey.religion, value: result.religion))410 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))411 412 return fields413 }414}415extension MBMalaysiaMyKasFrontRecognizer {416 override func extractFieldResults() -> NSArray {417 let fields = NSMutableArray()418 419 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))420 fields.add(MBField(key: MBFieldKey.city, value: result.city))421 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))422 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.fullAddress))423 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))424 fields.add(MBField(key: MBFieldKey.nricNumber, value: result.nric))425 fields.add(MBField(key: MBFieldKey.religion, value: result.religion))426 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))427 return fields428 }429}430extension MBMalaysiaMyPrFrontRecognizer {431 override func extractFieldResults() -> NSArray {432 let fields = NSMutableArray()433 434 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))435 fields.add(MBField(key: MBFieldKey.city, value: result.city))436 fields.add(MBField(key: MBFieldKey.country, value: result.countryCode))437 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.fullAddress))438 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))439 fields.add(MBField(key: MBFieldKey.nricNumber, value: result.nric))440 fields.add(MBField(key: MBFieldKey.religion, value: result.religion))441 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))442 443 return fields444 }445}446extension MBMalaysiaMyTenteraFrontRecognizer {447 override func extractFieldResults() -> NSArray {448 let fields = NSMutableArray()449 450 fields.add(MBField(key: MBFieldKey.nricNumber, value: result.nric))451 fields.add(MBField(key: MBFieldKey.armyNumber, value: result.armyNumber))452 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.fullAddress))453 fields.add(MBField(key: MBFieldKey.city, value: result.city))454 fields.add(MBField(key: MBFieldKey.addressStreet, value: result.street))455 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))456 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))457 fields.add(MBField(key: MBFieldKey.religion, value: result.religion))458 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))459 460 return fields461 }462}463extension MBMoroccoIdFrontRecognizer {464 override func extractFieldResults() -> NSArray {465 let fields = NSMutableArray()466 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))467 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))468 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))469 fields.add(MBField(key: MBFieldKey.firstName, value: result.name))470 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))471 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))472 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))473 return fields474 }475}476extension MBMoroccoIdBackRecognizer {477 override func extractFieldResults() -> NSArray {478 let fields = NSMutableArray()479 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))480 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))481 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))482 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))483 fields.add(MBField(key: MBFieldKey.civilStatusNumber, value: result.civilStatusNumber))484 return fields485 }486}487extension MBMrtdCombinedRecognizer {488 override func extractFieldResults() -> NSArray {489 return result.mrzResult.extractFieldResults()490 }491}492extension MBMexicoVoterIdFrontRecognizer {493 override func extractFieldResults() -> NSArray {494 let fields = NSMutableArray()495 496 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))497 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))498 fields.add(MBField(key: MBFieldKey.curp, value: result.curp))499 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))500 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))501 502 return fields503 }504}505extension MBPdf417Recognizer {506 override func extractFieldResults() -> NSArray {507 let fields = NSMutableArray()508 509 fields.add(MBField(key: MBFieldKey.barcodeData, value: result.stringData))510 511 return fields512 }513}514extension MBPolandCombinedRecognizer {515 override func extractFieldResults() -> NSArray {516 let fields = NSMutableArray()517 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))518 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))519 fields.add(MBField(key: MBFieldKey.familyName, value: result.familyName))520 fields.add(MBField(key: MBFieldKey.parentsGivenName, value: result.parentsGivenNames))521 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))522 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))523 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))524 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))525 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.personalNumber))526 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))527 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))528 return fields529 }530}531extension MBPolandIdBackRecognizer {532 override func extractFieldResults() -> NSArray {533 return result.mrzResult.extractFieldResults()534 }535}536extension MBPolandIdFrontRecognizer {537 override func extractFieldResults() -> NSArray {538 let fields = NSMutableArray()539 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))540 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))541 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))542 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))543 return fields544 }545}546extension MBRomaniaIdFrontRecognizer {547 override func extractFieldResults() -> NSArray {548 let fields = NSMutableArray()549 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))550 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))551 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.mrzResult.documentNumber))552 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))553 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))554 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))555 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))556 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))557 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))558 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))559 return fields560 }561}562extension MBSingaporeCombinedRecognizer {563 override func extractFieldResults() -> NSArray {564 let fields = NSMutableArray()565 fields.add(MBField(key: MBFieldKey.firstName, value: result.name))566 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))567 fields.add(MBField(key: MBFieldKey.bloodGroup, value: result.bloodGroup))568 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))569 fields.add(MBField(key: MBFieldKey.countryOfBirth, value: result.countryOfBirth))570 fields.add(MBField(key: MBFieldKey.race, value: result.race))571 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.identityCardNumber))572 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))573 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))574 return fields575 }576}577extension MBSingaporeIdBackRecognizer {578 override func extractFieldResults() -> NSArray {579 let fields = NSMutableArray()580 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))581 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.cardNumber))582 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))583 return fields584 }585}586extension MBSingaporeIdFrontRecognizer {587 override func extractFieldResults() -> NSArray {588 let fields = NSMutableArray()589 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.identityCardNumber))590 fields.add(MBField(key: MBFieldKey.firstName, value: result.name))591 fields.add(MBField(key: MBFieldKey.race, value: result.race))592 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))593 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))594 fields.add(MBField(key: MBFieldKey.countryOfBirth, value: result.countryOfBirth))595 return fields596 }597}598extension MBSlovakiaCombinedRecognizer {599 override func extractFieldResults() -> NSArray {600 let fields = NSMutableArray()601 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))602 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))603 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))604 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))605 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))606 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.personalNumber))607 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))608 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))609 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))610 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuedBy))611 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))612 fields.add(MBField(key: MBFieldKey.surnameAtBirth, value: result.surnameAtBirth))613 fields.add(MBField(key: MBFieldKey.specialRemarks, value: result.specialRemarks))614 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))615 return fields616 }617}618extension MBSlovakiaIdBackRecognizer {619 override func extractFieldResults() -> NSArray {620 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())621 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))622 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))623 return fields624 }625}626extension MBSlovakiaIdFrontRecognizer {627 override func extractFieldResults() -> NSArray {628 let fields = NSMutableArray()629 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))630 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))631 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.documentNumber))632 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))633 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))634 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.personalNumber))635 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))636 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))637 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))638 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))639 return fields640 }641}642extension MBSloveniaCombinedRecognizer {643 override func extractFieldResults() -> NSArray {644 let fields = NSMutableArray()645 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))646 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))647 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.documentNumber))648 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))649 fields.add(MBField(key: MBFieldKey.citizenship, value: result.nationality))650 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))651 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))652 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))653 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.pin))654 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.administrativeUnit))655 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))656 fields.add(MBField(key: MBFieldKey.expiryDatePermanent, value: result.dateOfExpiryPermanent))657 return fields658 }659}660extension MBSloveniaIdBackRecognizer {661 override func extractFieldResults() -> NSArray {662 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())663 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))664 fields.add(MBField(key: MBFieldKey.authority, value: result.administrativeUnit))665 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))666 return fields667 }668}669extension MBSloveniaIdFrontRecognizer {670 override func extractFieldResults() -> NSArray {671 let fields = NSMutableArray()672 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenNames))673 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))674 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))675 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))676 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))677 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))678 fields.add(MBField(key: MBFieldKey.expiryDatePermanent, value: result.dateOfExpiryPermanent))679 return fields680 }681}682extension MBSwitzerlandIdFrontRecognizer {683 override func extractFieldResults() -> NSArray {684 let fields = NSMutableArray()685 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenName))686 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))687 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))688 return fields689 }690}691extension MBSwitzerlandIdBackRecognizer {692 override func extractFieldResults() -> NSArray {693 let fields = NSMutableArray(array: result.mrzResult.extractFieldResults())694 fields.add(MBField(key: MBFieldKey.placeOfOrigin, value: result.placeOfOrigin))695 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.authority))696 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))697 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))698 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))699 return fields700 }701}702extension MBUnitedArabEmiratesIdFrontRecognizer {703 override func extractFieldResults() -> NSArray {704 let fields = NSMutableArray()705 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.idNumber))706 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))707 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))708 return fields709 }710}711extension MBUnitedArabEmiratesIdBackRecognizer {712 override func extractFieldResults() -> NSArray {713 return result.mrzResult.extractFieldResults()714 }715}716extension MBNigeriaVoterIdBackRecognizer {717 override func extractFieldResults() -> NSArray {718 let fields = NSMutableArray()719 720 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))721 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))722 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))723 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))724 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))725 fields.add(MBField(key: MBFieldKey.barcodeData, value: result.rawBarcodeData))726 727 return fields728 }729}730extension MBBelgiumIdFrontRecognizer {731 override func extractFieldResults() -> NSArray {732 let fields = NSMutableArray()733 734 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.cardNumber))735 736 return fields737 }738}739extension MBBelgiumIdBackRecognizer {740 override func extractFieldResults() -> NSArray {741 return result.mrzResult.extractFieldResults()742 }743}744extension MBBelgiumCombinedRecognizer {745 override func extractFieldResults() -> NSArray {746 let fields = NSMutableArray()747 748 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.cardNumber))749 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))750 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))751 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))752 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))753 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))754 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))755 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))756 757 return fields758 }759}...

Full Screen

Full Screen

MBDLExtractors.swift

Source:MBDLExtractors.swift Github

copy

Full Screen

1//2// DlExtractors.swift3// Showcase4//5// Created by Dominik Cubelic on 23/08/2018.6// Copyright © 2018 Dominik Cubelic. All rights reserved.7//8import Foundation9import MicroBlink10extension MBAustraliaDlFrontRecognizer {11 override func extractFieldResults() -> NSArray {12 let fields = NSMutableArray()13 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))14 fields.add(MBField(key: MBFieldKey.licenseType, value: result.licenceType))15 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))16 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))17 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))18 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.licenceExpiry))19 return fields20 }21}22extension MBAustraliaDlBackRecognizer {23 override func extractFieldResults() -> NSArray {24 let fields = NSMutableArray()25 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))26 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))27 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))28 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.licenceExpiry))29 return fields30 }31}32extension MBAustriaDlFrontRecognizer {33 override func extractFieldResults() -> NSArray {34 let fields = NSMutableArray()35 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))36 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))37 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))38 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))39 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))40 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))41 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))42 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))43 fields.add(MBField(key: MBFieldKey.vehicleCategories, value: result.vehicleCategories))44 return fields45 }46}47extension MBColombiaDlFrontRecognizer {48 override func extractFieldResults() -> NSArray {49 let fields = NSMutableArray()50 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))51 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))52 fields.add(MBField(key: MBFieldKey.driverRestrictions, value: result.driverRestrictions))53 fields.add(MBField(key: MBFieldKey.issuingAgency, value: result.issuingAgency))54 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))55 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))56 return fields57 }58}59extension MBEudlRecognizer {60 override func extractFieldResults() -> NSArray {61 let fields = NSMutableArray()62 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))63 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))64 fields.add(MBField(key: MBFieldKey.birthData, value: result.birthData))65 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.issueDate))66 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.expiryDate))67 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))68 fields.add(MBField(key: MBFieldKey.personalIdentificationNumber, value: result.personalNumber))69 fields.add(MBField(key: MBFieldKey.driverNumber, value: result.driverNumber))70 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))71 return fields72 }73}74extension MBGermanyDlBackRecognizer {75 override func extractFieldResults() -> NSArray {76 let fields = NSMutableArray()77 78 fields.add(MBField(key: MBFieldKey.dateOfIssueB10, value: result.dateOfIssueB10))79 80 return fields81 }82}83extension MBGermanyDlFrontRecognizer {84 override func extractFieldResults() -> NSArray {85 let fields = NSMutableArray()86 87 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))88 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))89 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))90 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))91 fields.add(MBField(key: MBFieldKey.authority, value: result.issuingAuthority))92 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))93 fields.add(MBField(key: MBFieldKey.licenseCategories, value: result.licenceCategories))94 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))95 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))96 return fields97 }98}99extension MBItalyDlFrontRecognizer {100 override func extractFieldResults() -> NSArray {101 let fields = NSMutableArray()102 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))103 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))104 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))105 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))106 fields.add(MBField(key: MBFieldKey.firstName, value: result.givenName))107 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))108 fields.add(MBField(key: MBFieldKey.licenseCategories, value: result.licenceCategories))109 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))110 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))111 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))112 return fields113 }114}115extension MBIrelandDlFrontRecognizer {116 override func extractFieldResults() -> NSArray {117 let fields = NSMutableArray()118 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))119 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))120 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))121 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))122 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))123 fields.add(MBField(key: MBFieldKey.issuer, value: result.issuedBy))124 fields.add(MBField(key: MBFieldKey.licenseCategories, value: result.licenceCategories))125 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))126 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))127 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))128 return fields129 }130}131extension MBMalaysiaDlFrontRecognizer {132 override func extractFieldResults() -> NSArray {133 let fields = NSMutableArray()134 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))135 fields.add(MBField(key: MBFieldKey.identityCardNumber, value: result.identityNumber))136 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))137 fields.add(MBField(key: MBFieldKey.dlClass, value: result.dlClass))138 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.validFrom))139 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.validUntil))140 fields.add(MBField(key: MBFieldKey.addressStreet, value: result.street))141 fields.add(MBField(key: MBFieldKey.city, value: result.city))142 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.fullAddress))143 return fields144 }145}146extension MBNewZealandDlFrontRecognizer {147 override func extractFieldResults() -> NSArray {148 let fields = NSMutableArray()149 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstNames))150 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))151 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))152 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))153 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))154 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))155 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenseNumber))156 return fields157 }158}159extension MBSingaporeDlFrontRecognizer {160 override func extractFieldResults() -> NSArray {161 let fields = NSMutableArray()162 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.birthDate))163 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.issueDate))164 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))165 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))166 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.validTill))167 return fields168 }169}170extension MBSpainDlFrontRecognizer {171 override func extractFieldResults() -> NSArray {172 let fields = NSMutableArray()173 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))174 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))175 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.number))176 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))177 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))178 fields.add(MBField(key: MBFieldKey.licenseCategories, value: result.licenceCategories))179 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))180 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.validFrom))181 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.validUntil))182 return fields183 }184}185extension MBSwedenDlFrontRecognizer {186 override func extractFieldResults() -> NSArray {187 let fields = NSMutableArray()188 fields.add(MBField(key: MBFieldKey.firstName, value: result.name))189 fields.add(MBField(key: MBFieldKey.lastName, value: result.surname))190 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))191 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))192 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))193 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAgency))194 fields.add(MBField(key: MBFieldKey.licenseCategories, value: result.licenceCategories))195 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenceNumber))196 return fields197 }198}199extension MBSwitzerlandDlFrontRecognizer {200 override func extractFieldResults() -> NSArray {201 let fields = NSMutableArray()202 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))203 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))204 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))205 fields.add(MBField(key: MBFieldKey.expiryDatePermanent, value: result.expiryDatePermanent))206 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))207 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.issuingAuthority))208 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))209 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenseNumber))210 fields.add(MBField(key: MBFieldKey.placeOfBirth, value: result.placeOfBirth))211 fields.add(MBField(key: MBFieldKey.vehicleCategories, value: result.vehicleCategories))212 return fields213 }214}215extension MBUnitedArabEmiratesDlFrontRecognizer {216 override func extractFieldResults() -> NSArray {217 let fields = NSMutableArray()218 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))219 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.expiryDate))220 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.issueDate))221 fields.add(MBField(key: MBFieldKey.licenseNumber, value: result.licenseNumber))222 fields.add(MBField(key: MBFieldKey.issuingAuthority, value: result.licensingAuthority))223 fields.add(MBField(key: MBFieldKey.fullName, value: result.name))224 fields.add(MBField(key: MBFieldKey.nationality, value: result.nationality))225 fields.add(MBField(key: MBFieldKey.placeOfIssue, value: result.placeOfIssue))226 return fields227 }228}229extension MBUsdlRecognizer {230 override func extractFieldResults() -> NSArray {231 let fields = NSMutableArray()232 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))233 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))234 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))235 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))236 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))237 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))238 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))239 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.getField(MBUsdlKeys.CustomerIdNumber)))240 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))241 fields.add(MBField(key: MBFieldKey.driverRestrictions, value: result.restrictions))242 fields.add(MBField(key: MBFieldKey.endorsements, value: result.endorsements))243 fields.add(MBField(key: MBFieldKey.vehicleClass, value: result.vehicleClass))244 if let data = result.data() {245 let dataString = String(data: data, encoding: String.Encoding.utf8)246 fields.add(MBField(key: MBFieldKey.barcodeData, value: dataString))247 }248 return fields249 }250}251extension MBUsdlCombinedRecognizer {252 override func extractFieldResults() -> NSArray {253 let fields = NSMutableArray()254 fields.add(MBField(key: MBFieldKey.firstName, value: result.firstName))255 fields.add(MBField(key: MBFieldKey.lastName, value: result.lastName))256 fields.add(MBField(key: MBFieldKey.fullName, value: result.fullName))257 fields.add(MBField(key: MBFieldKey.fullAddress, value: result.address))258 fields.add(MBField(key: MBFieldKey.dateOfBirth, value: result.dateOfBirth))259 fields.add(MBField(key: MBFieldKey.dateOfIssue, value: result.dateOfIssue))260 fields.add(MBField(key: MBFieldKey.dateOfExpiry, value: result.dateOfExpiry))261 fields.add(MBField(key: MBFieldKey.documentNumber, value: result.getField(MBUsdlKeys.CustomerIdNumber)))262 fields.add(MBField(key: MBFieldKey.sex, value: result.sex))263 fields.add(MBField(key: MBFieldKey.driverRestrictions, value: result.restrictions))264 fields.add(MBField(key: MBFieldKey.endorsements, value: result.endorsements))265 fields.add(MBField(key: MBFieldKey.vehicleClass, value: result.vehicleClass))266 if let data = result.data() {267 let dataString = String(data: data, encoding: String.Encoding.utf8)268 fields.add(MBField(key: MBFieldKey.barcodeData, value: dataString))269 }270 return fields271 }272}...

Full Screen

Full Screen

LiteralConvertible.swift

Source:LiteralConvertible.swift Github

copy

Full Screen

2// LiteralConvertible.swift3//4// Copyright (c) 2015-2016 Damien (http://delba.io)5//6// Permission is hereby granted, free of charge, to any person obtaining a copy7// of this software and associated documentation files (the "Software"), to deal8// in the Software without restriction, including without limitation the rights9// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10// copies of the Software, and to permit persons to whom the Software is11// furnished to do so, subject to the following conditions:12//13// The above copyright notice and this permission notice shall be included in all14// copies or substantial portions of the Software.15//16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE22// SOFTWARE.23//24// MARK: - StringLiteralConvertible25/// Conforming types can be initialized with arbitrary string literals.26extension JSON: StringLiteralConvertible {27 /**28 Creates an instance of JSON from a string literal29 - parameter stringLiteral: A string literal30 - returns: An instance of JSON31 */32 public init(stringLiteral value: StringLiteralType) {33 self.init(value)34 }35 /**36 Creates an instance of JSON from a string literal37 - parameter extendedGraphemeClusterLiteral: A string literal38 - returns: An instance of JSON39 */40 public init(extendedGraphemeClusterLiteral value: StringLiteralType) {41 self.init(value)42 }43 /**44 Creates an instance of JSON from a string literal45 - parameter unicodeScalarLiteral: A string literal46 - returns: An instance of JSON47 */48 public init(unicodeScalarLiteral value: StringLiteralType) {49 self.init(value)50 }51}52// MARK: - IntegerLiteralConvertible53/// Conforming types can be initialized with integer literals.54extension JSON: IntegerLiteralConvertible {55 /**56 Creates an instance of JSON from an integer literal.57 - parameter integerLiteral: An integer literal58 - returns: An instance of JSON59 */60 public init(integerLiteral value: IntegerLiteralType) {61 self.init(value)62 }63}64// MARK: - FloatLiteralConvertible65/// Conforming types can be initialized with float literals.66extension JSON: FloatLiteralConvertible {67 /**68 Creates an instance of JSON from a float literal.69 - parameter floatLiteral: A float literal70 - returns: An instance of JSON71 */72 public init(floatLiteral value: FloatLiteralType) {73 self.init(value)74 }75}76// MARK: - BooleanLiteralConvertible77/// Conforming types can be initialized with the Boolean literals true and false.78extension JSON: BooleanLiteralConvertible {79 /**80 Creates an instance of JSON from a boolean literal.81 - parameter booleanLiteral: A boolean literal82 - returns: An instance of JSON83 */84 public init(booleanLiteral value: BooleanLiteralType) {85 self.init(value)86 }87}88// MARK: - DictionaryLiteralConvertible89/// Conforming types can be initialized with dictionary literals.90extension JSON: DictionaryLiteralConvertible {91 /**92 Creates an instance of JSON from a dictionary literal.93 - parameter dictionaryLiteral: A dictionary literal94 - returns: An instance of JSON95 */96 public init(dictionaryLiteral elements: (String, AnyObject)...) {97 var dictionary = [String: AnyObject]()98 for (key, value) in elements {99 dictionary[key] = value100 }101 self.init(dictionary)102 }103}104// MARK: - ArrayLiteralConvertible105/// Conforming types can be initialized with array literals.106extension JSON: ArrayLiteralConvertible {107 /**108 Creates an instance of JSON from an array literal.109 - parameter arrayLiteral: An array literal110 - returns: An instance of JSON111 */112 public init(arrayLiteral elements: AnyObject...) {113 self.init(elements)114 }115}116// MARK: - NilLiteralConvertible117/// Conforming types can be initialized with nil.118extension JSON: NilLiteralConvertible {119 /**120 Creates an instance of JSON from a nil literal.121 - parameter nilLiteral: A nil literal122 - returns: An instance of JSON123 */124 public init(nilLiteral: ()) {125 self.init(object: nil)126 }127}...

Full Screen

Full Screen

of

Using AI Code Generation

copy

Full Screen

1func quickSort<T: Comparable>(_ array: [T]) -> [T] {2 guard array.count > 1 else { return array }3 let less = array.filter { $0 < pivot }4 let equal = array.filter { $0 == pivot }5 let greater = array.filter { $0 > pivot }6 return quickSort(less) + equal + quickSort(greater)7}8func heapSort<T: Comparable>(_ array: [T]) -> [T] {9 var heap = Heap(array)10 var sortedArray = [T]()11 while !heap.isEmpty {12 sortedArray.append(heap.remove()!)13 }14}15func mergeSort<T: Comparable>(_ array: [T]) -> [T] {16 guard array.count > 1 else { return array }17 let leftArray = mergeSort(Array(array[0..<middleIndex]))18 let rightArray = mergeSort(Array(array[middleIndex..<array.count]))19 return merge(leftPile: leftArray, rightPile: rightArray)20}21func merge<T: Comparable>(leftPile: [T], rightPile: [T]) -> [T] {22 var orderedPile = [T]()23 while leftIndex < leftPile.count && rightIndex < rightPile.count {24 if leftPile[leftIndex] < rightPile[rightIndex] {25 orderedPile.append(leftPile[leftIndex])26 } else if leftPile[leftIndex] > rightPile[rightIndex] {27 orderedPile.append(rightPile[rightIndex])28 } else {29 orderedPile.append(leftPile[leftIndex])30 orderedPile.append(rightPile[rightIndex])31 }32 }33 while leftIndex < leftPile.count {34 orderedPile.append(leftPile[leftIndex])35 }36 while rightIndex < rightPile.count {37 orderedPile.append(rightPile[rightIndex])38 }

Full Screen

Full Screen

of

Using AI Code Generation

copy

Full Screen

1import UIKit2class QuickSort: NSObject {3 func quickSort(array: [Int]) -> [Int] {4 if array.count < 2 {5 } else {6 let less = array.filter { $0 < pivot }7 let equal = array.filter { $0 == pivot }8 let greater = array.filter { $0 > pivot }9 return quickSort(array: less) + equal + quickSort(array: greater)10 }11 }12}13import UIKit14class ViewController: UIViewController {15 override func viewDidLoad() {16 super.viewDidLoad()17 let quickSort = QuickSort()18 print(quickSort.quickSort(array: [10, 5, 2, 3]))19 }20 override func didReceiveMemoryWarning() {21 super.didReceiveMemoryWarning()22 }

Full Screen

Full Screen

of

Using AI Code Generation

copy

Full Screen

1func main() {2 arr.quickSort()3 print(arr)4}5class QuickSort {6 func quickSort<T: Comparable>(_ array: [T], _ isOrderedBefore: (T, T) -> Bool) -> [T] {7 guard array.count > 1 else { return array }8 let less = array.filter { isOrderedBefore($0, pivot) }9 let equal = array.filter { isOrderedBefore(pivot, $0) == false && isOrderedBefore($0, pivot) == false }10 let greater = array.filter { isOrderedBefore(pivot, $0) }11 return quickSort(less, isOrderedBefore) + equal + quickSort(greater, isOrderedBefore)12 }13}14extension Array where Element: Comparable {15 func quickSort() -> [Element] {16 return QuickSort().quickSort(self, <)17 }18}19main()

Full Screen

Full Screen

of

Using AI Code Generation

copy

Full Screen

1import Foundation2class QuickSort {3 init(array: [Int]) {4 }5 func sort() -> [Int] {6 return quickSort(array: self.array)7 }8 func quickSort(array: [Int]) -> [Int] {9 guard array.count > 1 else {10 }11 let left = array.filter { $0 < pivot }12 let middle = array.filter { $0 == pivot }13 let right = array.filter { $0 > pivot }14 return quickSort(array: left) + middle + quickSort(array: right)15 }16}17import Foundation18class QuickSort {19 init(array: [Int]) {20 }21 func sort() -> [Int] {22 return quickSort(array: self.array)23 }24 func quickSort(array: [Int]) -> [Int] {25 guard array.count > 1 else {26 }27 let left = array.filter { $0 < pivot }28 let middle = array.filter { $0 == pivot }29 let right = array.filter { $0 > pivot }30 return quickSort(array: left) + middle + quickSort(array: right)31 }32}33import Foundation34class QuickSort {35 init(array: [Int]) {36 }37 func sort() -> [Int] {38 return quickSort(array: self.array)39 }40 func quickSort(array: [Int]) -> [Int] {41 guard array.count > 1 else {42 }43 let left = array.filter { $0 < pivot }44 let middle = array.filter { $0 == pivot }45 let right = array.filter { $0 > pivot }46 return quickSort(array: left) + middle + quickSort(array: right)47 }48}

Full Screen

Full Screen

of

Using AI Code Generation

copy

Full Screen

1let quickSort = QuickSort()2let quickSortedArray = quickSort.quickSort(array: [2, 1, 4, 3, 6, 5])3print(quickSortedArray)4let mergeSort = MergeSort()5let mergeSortedArray = mergeSort.mergeSort(array: [2, 1, 4, 3, 6, 5])6print(mergeSortedArray)7let bubbleSort = BubbleSort()8let bubbleSortedArray = bubbleSort.bubbleSort(array: [2, 1, 4, 3, 6, 5])9print(bubbleSortedArray)10let insertionSort = InsertionSort()11let insertionSortedArray = insertionSort.insertionSort(array: [2, 1, 4, 3, 6, 5])12print(insertionSortedArray)13let selectionSort = SelectionSort()14let selectionSortedArray = selectionSort.selectionSort(array: [2, 1, 4, 3, 6, 5])15print(selectionSortedArray)16let heapSort = HeapSort()17let heapSortedArray = heapSort.heapSort(array: [2, 1, 4, 3, 6, 5])18print(heapSortedArray)19let countingSort = CountingSort()20let countingSortedArray = countingSort.countingSort(array: [2, 1, 4, 3, 6, 5])21print(countingSortedArray)22let radixSort = RadixSort()23let radixSortedArray = radixSort.radixSort(array: [2, 1, 4, 3, 6, 5])24print(radixSortedArray)25let bucketSort = BucketSort()26let bucketSortedArray = bucketSort.bucketSort(array

Full Screen

Full Screen

of

Using AI Code Generation

copy

Full Screen

1import Foundation2class QuickSort {3 var array = [Int]()4 init(array: [Int]) {5 }6 func sort() -> [Int] {7 if low < high {8 while i < j {9 while array[i] <= array[pivot] && i <= high {10 }11 while array[j] > array[pivot] && j >= low {12 }13 if i < j {14 }15 }16 var leftArray = [Int]()17 var rightArray = [Int]()18 for index in 0..<pivot {19 leftArray.append(array[index])20 }21 for index in pivot + 1..<array.count {22 rightArray.append(array[index])23 }24 let left = QuickSort(array: leftArray)25 let right = QuickSort(array: rightArray)26 let leftSortedArray = left.sort()27 let rightSortedArray = right.sort()28 var sortedArray = [Int]()29 for index in 0..<leftSortedArray.count {30 sortedArray.append(leftSortedArray[index])31 }32 sortedArray.append(array[pivot])33 for index in 0..<rightSortedArray.count {34 sortedArray.append(rightSortedArray[index])35 }36 }37 }38}39var array = [Int]()40array.append(1)41array.append(4)42array.append(2)43array.append(3)44array.append(5)45array.append(7)46array.append(6)47let quickSort = QuickSort(array: array)48let sortedArray = quickSort.sort()49print(sortedArray)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Quick automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful