diff --git a/programming/android/api-reference/document-type.md b/programming/android/api-reference/document-type.md
index 47c6adb..f16a716 100644
--- a/programming/android/api-reference/document-type.md
+++ b/programming/android/api-reference/document-type.md
@@ -10,7 +10,7 @@ breadcrumbText: EnumDocumentType
# EnumDocumentType
-`EnumDocumentType` is a enumeration class that defines the type of document to scan, such as ID cards or passports.
+`EnumDocumentType` is an enumeration class that defines the type of document to scan, such as ID cards or passports.
## Definition
diff --git a/programming/android/api-reference/mrz-data.md b/programming/android/api-reference/mrz-data.md
index 42810f9..8f17b77 100644
--- a/programming/android/api-reference/mrz-data.md
+++ b/programming/android/api-reference/mrz-data.md
@@ -26,21 +26,21 @@ class MRZData
| Method | Description |
| ------ | ----------- |
-| [`getFirstName`](#getfirstname) | Returns the first name. |
-| [`getLastName`](#getlastname) | Returns the last name. |
-| [`getSex`](#getsex) | Returns the sex. |
-| [`getIssuingState`](#getissuingstate) | Returns the issuing state. |
-| [`getNationality`](#getnationality) | Returns the nationality. |
-| [`getDateOfBirth`](#getdateofbirth) | Returns the date of birth. |
-| [`getDateOfExpire`](#getdateofexpire) | Returns the date of expire. |
-| [`getDocumentType`](#getdocumenttype) | Returns the type of document. |
-| [`getDocumentNumber`](#getdocumentnumber) | Returns the document number. |
-| [`getAge`](#getage) | Returns the age. |
-| [`getMrzText`](#getmrztext) | Returns the raw text of MRZ. |
+| [`getFirstName`](#getfirstname) | Returns the first name of the user of the MRZ document. |
+| [`getLastName`](#getlastname) | Returns the last name of the user of the MRZ document. |
+| [`getSex`](#getsex) | Returns the sex of the user of the MRZ document. |
+| [`getIssuingState`](#getissuingstate) | Returns the issuing state of the MRZ document. |
+| [`getNationality`](#getnationality) | Returns the nationality of the user of the MRZ document. |
+| [`getDateOfBirth`](#getdateofbirth) | Returns the date of birth of the user of the MRZ document. |
+| [`getDateOfExpire`](#getdateofexpire) | Returns the expiry date of the MRZ document. |
+| [`getDocumentType`](#getdocumenttype) | Returns the type of MRZ document. |
+| [`getDocumentNumber`](#getdocumentnumber) | Returns the MRZ document number. |
+| [`getAge`](#getage) | Returns the age of the user of the MRZ document. |
+| [`getMrzText`](#getmrztext) | Returns the raw text of the MRZ. |
### getFirstName
-Returns the first name.
+Returns the first name of the user of the MRZ document.
```java
String getFirstName();
@@ -52,7 +52,7 @@ The first name.
### getLastName
-Returns the last name.
+Returns the last name of the user of the MRZ document.
```java
String getLastName();
@@ -64,7 +64,7 @@ The last name.
### getSex
-Returns the sex.
+Returns the sex of the user of the MRZ document.
```java
String getSex();
@@ -76,7 +76,7 @@ The sex.
### getIssuingState
-Returns the issuing state.
+Returns the issuing state of the MRZ document.
```java
String getIssuingState();
@@ -88,7 +88,7 @@ The issuing state.
### getNationality
-Returns the nationality.
+Returns the nationality of the user of the MRZ document.
```java
String getNationality();
@@ -100,7 +100,7 @@ The nationality.
### getDateOfBirth
-Returns the date of birth.
+Returns the date of birth of the user of the MRZ document.
```java
String getDateOfBirth();
@@ -112,7 +112,7 @@ The date of birth.
### getDateOfExpire
-Returns the date of expire.
+Returns the expiry date of the MRZ document.
```java
String getDateOfExpire();
@@ -120,11 +120,11 @@ String getDateOfExpire();
**Return Value**
-The date of expire.
+The date of expiry.
### getDocumentType
-Returns the type of document.
+Returns the type of MRZ document.
```java
String getDocumentType();
@@ -136,7 +136,7 @@ The type of document, such as ID cards or passports.
### getDocumentNumber
-Returns the document number.
+Returns the MRZ document number.
```java
String getDocumentNumber();
@@ -148,7 +148,7 @@ The document number.
### getAge
-Returns the age.
+Returns the age of the user of the MRZ document.
```java
int getAge();
@@ -160,7 +160,7 @@ The age.
### getMrzText
-Returns the raw text of MRZ.
+Returns the raw text of the MRZ.
```java
String getMrzText();
@@ -168,4 +168,4 @@ String getMrzText();
**Return Value**
-The raw text of MRZ.
+The raw text of the MRZ.
diff --git a/programming/android/api-reference/mrz-scan-result.md b/programming/android/api-reference/mrz-scan-result.md
index a5c9422..8ca6846 100644
--- a/programming/android/api-reference/mrz-scan-result.md
+++ b/programming/android/api-reference/mrz-scan-result.md
@@ -10,7 +10,7 @@ breadcrumbText: MRZScanResult
# MRZScanResult
-`MRZScanResult` is a result class that contains the parsed MRZ information from one scan and the additional information.
+`MRZScanResult` is a result class that contains the parsed MRZ information and the corresponding additional information.
## Definition
@@ -26,14 +26,14 @@ class MRZScanResult
| Method | Description |
| ------ | ----------- |
-| [`getData`](#getdata) | Returns the parsed [`MRZ data`](mrz-data.md). |
-| [`getResultStatus`](#getresultstatus) | Get the status of the result, which can be finished, canceled or exception. |
+| [`getData`](#getdata) | Returns the parsed MRZ data. |
+| [`getResultStatus`](#getresultstatus) | Returns the result status, which can be finished, canceled or exception. |
| [`getErrorCode`](#geterrorcode) | Returns the error code should something go wrong during the MRZ scanning process. |
| [`getErrorString`](#geterrorstring) | Returns the error message associated with the error code should something go wrong during the MRZ scanning process. |
### getData
-Returns the parsed [`MRZ data`](mrz-data.md).
+Returns the parsed MRZ information as a [`MRZData`](mrz-data.md) object.
```java
MRZData getData();
@@ -45,7 +45,7 @@ A [`MRZData`](mrz-data.md) object that contains the parsed MRZ data.
### getResultStatus
-Get the status of the result, which can be finished, canceled or exception.
+Returns the status of the result, which can be finished, canceled or exception.
```java
@EnumResultStatus
diff --git a/programming/android/api-reference/mrz-scanner-config.md b/programming/android/api-reference/mrz-scanner-config.md
index c4beb86..8e60d7e 100644
--- a/programming/android/api-reference/mrz-scanner-config.md
+++ b/programming/android/api-reference/mrz-scanner-config.md
@@ -26,20 +26,20 @@ final class MRZScannerConfig
| Method | Description |
| ------ | ----------- |
-| [`setLicense`](#setlicense) | Set the license. |
-| [`setTemplateFilePath`](#settemplatefilepath) | Set a path for the SDK to load template file. |
-| [`setTorchButtonVisible`](#settorchbuttonvisible) | Set whether to display the torch button when scanning. Uses can click the torch button to turn on/off the torch. |
-| [`setBeepEnabled`](#setbeepenabled) | Set whether to trigger a beep sound when MRZ is scanned. |
-| [`setCloseButtonVisible`](#setclosebuttonvisible) | Set whether to display a button for uses to close the scanner page. |
-| [`setDocumentType`](#setdocumenttype) | Specifies the type of document to scan, such as ID cards or passports. |
+| [`setLicense`](#setlicense) | Sets the license string. |
+| [`setTemplateFilePath`](#settemplatefilepath) | Sets the local file path for the JSON parameters template file. |
+| [`setTorchButtonVisible`](#settorchbuttonvisible) | Sets whether to display the torch button when scanning. |
+| [`setBeepEnabled`](#setbeepenabled) | Sets whether the beep sound is triggered or not when a MRZ is scanned. |
+| [`setCloseButtonVisible`](#setclosebuttonvisible) | Sets the visibility status of the close button for users to close the scanner page. |
+| [`setDocumentType`](#setdocumenttype) | Sets the type of document to scan, such as ID cards or passports. |
| [`getLicense`](#getlicense) | Returns the license string. |
-| [`getTemplateFilePath`](#gettemplatefilepath) | Get the file path of the template file. |
-| [`isTorchButtonVisible`](#istorchbuttonvisible) | Returns whether the torch button is visible. |
-| [`isBeepEnabled`](#isbeepenabled) | Returns whether the beep sound is enabled. |
-| [`isCloseButtonVisible`](#isclosebuttonvisible) | Returns whether the close button is visible. |
+| [`getTemplateFilePath`](#gettemplatefilepath) | Returns the local path of the settings template file. |
+| [`isTorchButtonVisible`](#istorchbuttonvisible) | Returns the visibility status of the torch button. |
+| [`isBeepEnabled`](#isbeepenabled) | Returns the play status of the beep sound when a MRZ is scanned. |
+| [`isCloseButtonVisible`](#isclosebuttonvisible) | Returns the visibility status of the close button. |
| [`getDocumentType`](#getdocumenttype) | Returns the type of document to scan, such as ID cards or passports. |
-| [`isGuideFrameVisible`](#isguideframevisible) | Returns whether the guide frame is visible. |
-| [`setGuideFrameVisible`](#setguideframevisible) | Set whether to display the guide frame. |
+| [`isGuideFrameVisible`](#isguideframevisible) | Returns the visibility status of the guide frame on the display. |
+| [`setGuideFrameVisible`](#setguideframevisible) | Sets the visibility of the guide frame on the display. |
### setLicense
@@ -67,7 +67,7 @@ void setTemplateFilePath(String templateFilePath);
### setTorchButtonVisible
-Set whether to display the torch button when scanning. Uses can click the torch button to turn on/off the torch.
+Sets whether to display the torch button when scanning. Users can click the torch button to turn on/off the torch.
```java
void setTorchButtonVisible(boolean torchButtonVisible);
@@ -79,7 +79,7 @@ void setTorchButtonVisible(boolean torchButtonVisible);
### setBeepEnabled
-Set whether to trigger a beep sound when a MRZ is scanned.
+Sets whether the beep sound is triggered or not when a MRZ is scanned.
```java
void setBeepEnabled(boolean beepEnabled);
@@ -91,7 +91,7 @@ void setBeepEnabled(boolean beepEnabled);
### setCloseButtonVisible
-Set whether to display a button for uses to close the scanner page.
+Sets the visibility status of the close button for users to close the scanner page.
```java
void setCloseButtonVisible(boolean closeButtonVisible);
@@ -103,7 +103,7 @@ void setCloseButtonVisible(boolean closeButtonVisible);
### setDocumentType
-Specifies the type of document to scan, such as ID cards or passports.
+Sets the type of document to scan, such as ID cards or passports.
```java
void setDocumentType(EnumDocumentType type);
@@ -127,7 +127,7 @@ The license key to be used for initialization.
### getTemplateFilePath
-Get the file path of the template file.
+Returns the local path of the settings template file.
```java
String getTemplateFilePath();
@@ -187,7 +187,7 @@ The type of document to scan, such as ID cards or passports.
### isGuideFrameVisible
-Returns whether the guide frame is visible.
+Returns the visibility status of the guide frame on the display.
```java
boolean isGuideFrameVisible();
diff --git a/programming/android/user-guide/index.md b/programming/android/user-guide/index.md
index 0dd1c35..2a72b00 100644
--- a/programming/android/user-guide/index.md
+++ b/programming/android/user-guide/index.md
@@ -16,15 +16,15 @@ This user guide will walk through the [ScanMRZ](https://github.com/Dynamsoft/mrz
## Supported Machine-Readable Travel Document Types
-The Machine Readable Travel Documents (MRTD) standard specified by the International Civil Aviation Organization (ICAO) defines how to encode information for optical character recognition on official travel documents.
+The Machine Readable Travel Document (MRTD) standard specified by the International Civil Aviation Organization (ICAO) defines how to encode information for optical character recognition on official travel documents.
Currently, the SDK supports three types of MRTD:
-> Note: If you need support for other types of MRTDs, our SDK can be easily customized. Please contact the [Dynamsoft Support Team](https://www.dynamsoft.com/contact/).
+> Note: If you need support for other types of MRTDs, our SDK can be easily customized. Please contact the [Dynamsoft Support Team](https://www.dynamsoft.com/contact/) if you have such a request.
### ID (TD1 Size)
-The MRZ (Machine Readable Zone) in TD1 format consists of 3 lines, each containing 30 characters.
+The MRZ (Machine Readable Zone) in TD1 format consists of 3 lines with 30 characters in each line.
@@ -32,7 +32,7 @@ The MRZ (Machine Readable Zone) in TD1 format consists of 3 lines, each containi
### ID (TD2 Size)
-The MRZ (Machine Readable Zone) in TD2 format consists of 2 lines, with each line containing 36 characters.
+The MRZ (Machine Readable Zone) in TD2 format consists of 2 lines with 36 characters in each line.
@@ -40,7 +40,7 @@ The MRZ (Machine Readable Zone) in TD2 format consists of 2 lines, with each li
### Passport (TD3 Size)
-The MRZ (Machine Readable Zone) in TD3 format consists of 2 lines, with each line containing 44 characters.
+The MRZ (Machine Readable Zone) in TD3 format consists of 2 lines with 44 characters in each line.
@@ -92,13 +92,49 @@ The first thing that we are going to do is to create a fresh new project. Here a
## Step 2: Include the Library
-Add the SDK to your new project. Please read [Add the SDK](#add-the-sdk) section for more details.
+Please read [Add the SDK](#add-the-sdk) section for instructions on how to add the SDK to your Android project.
-## Step 3: Initialize the License
+## Step 3: Get Prepare for the Layout File
+
+Open your **activity_main.xml** and replace it with the following code. In the layout file, we prepared 2 UI elements:
+
+- A `TextView` for displaying the MRZ scanning result.
+- A "START SCANNING" button for opening the scanner view.
+
+```xml
+
+
+
+
+
+
+
+```
+
+## Step 4: Initialize the License
The first step in code configuration is to include a valid license in the `MRZScannerConfig` object, which is used when launching the scanner.
-We first start with the package imports and then start implementing the MainActivity class, which starts with some simple Android UI configuration and creating the TextView that will display the results, followed by defining the license via the `setLicense` method of `MRZScannerConfig`.
+We first start with the package imports and then proceed to implementing the MainActivity class. That begins with configuring the `TextView` to display the MRZ document info once it is recognized, followed by defining the license via the `setLicense` method of `MRZScannerConfig`.
>- Java
@@ -158,7 +194,7 @@ class MainActivity : AppCompatActivity() {
>- The license string here grants a time-limited free trial which requires network connection to work.
>- You can request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=mrz&utm_source=guide&package=ios){:target="_blank"} link.
-## Step 4: Implementing the MRZ Scanner
+## Step 5: Implementing the MRZ Scanner
Now that the MRZ Scanner is configured and the license has been set, it is time to implement the actions (via the `launcher`) to take when a MRZ is scanned. Once the launcher is called, the MRZ Scanner opens the camera and begins the scanning process.
@@ -174,13 +210,12 @@ Once a MRZ is found, the content of the extracted information from the MRZ is ou
```java
public class MainActivity extends AppCompatActivity {
private ActivityResultLauncher launcher;
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- /* */
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ /* CONTINUATION OF THE CODE FROM STEP 3 */
launcher = registerForActivityResult(new MRZScannerActivity.ResultContract(), result -> {
if (result.getResultStatus() == MRZScanResult.EnumResultStatus.RS_FINISHED && result.getData() != null) {
- String content = "Result: document type: " + result.getData().getDocumentType() + "\n" + "document number: "
- + result.getData().getDocumentNumber();
+ String content = "Result: document type: " + result.getData().getDocumentType() + "\n" + "document number: " + result.getData().getDocumentNumber();
textView.setText(content);
} else if(result.getResultStatus() == MRZScanResult.EnumResultStatus.RS_CANCELED ){
textView.setText("Scan canceled.");
@@ -189,69 +224,36 @@ public class MainActivity extends AppCompatActivity {
textView.setText(result.getErrorString());
}
});
- findViewById(R.id.btn_navigate).setOnClickListener(v -> launcher.launch(config));
+ findViewById(R.id.btn_navigate).setOnClickListener(v -> launcher.launch(config));
}
}
```
-1.
+2.
```kotlin
class MainActivity : AppCompatActivity() {
private lateinit var launcher: ActivityResultLauncher
override fun onCreate(savedInstanceState: Bundle?) {
- launcher = registerForActivityResult(MRZScannerActivity.ResultContract()) { result ->
- if (result.resultStatus == MRZScanResult.EnumResultStatus.RS_FINISHED && result.data != null) {
- val content = """
- Result: document type: ${result.data.documentType}
- document number: ${result.data.documentNumber}
- """.trimIndent()
- textView.text = content
- } else if (result.resultStatus == MRZScanResult.EnumResultStatus.RS_CANCELED) {
- textView.text = "Scan canceled."
- }
- if (result.errorString != null && result.errorString.isNotEmpty()) {
- textView.text = result.errorString
- }
+ launcher = registerForActivityResult(MRZScannerActivity.ResultContract()) { result ->
+ if (result.resultStatus == MRZScanResult.EnumResultStatus.RS_FINISHED && result.data != null) {
+ val content = """
+ Result: document type: ${result.data.documentType}
+ document number: ${result.data.documentNumber}
+ """.trimIndent()
+ textView.text = content
+ } else if (result.resultStatus == MRZScanResult.EnumResultStatus.RS_CANCELED) {
+ textView.text = "Scan canceled."
}
- findViewById(R.id.btn_navigate).setOnClickListener {
- launcher.launch(config)
+ if (result.errorString != null && result.errorString.isNotEmpty()) {
+ textView.text = result.errorString
}
+ }
+ findViewById(R.id.btn_navigate).setOnClickListener {
+ launcher.launch(config)
+ }
}
}
```
-## Step 5: Configure your layout file
-
-Open your **activity_main.xml** and replace it with the following code:
-
-```xml
-
-
-
-
-
-
-
-```
-
## Step 6: Configure the MRZ Scanner (optional)
This next step, although optional, is highly recommended to help achieve a more smooth-looking and intuitive UI. In this setup we will configure the visibility of the torch button as well as the close button. To do this, we are going back to the `MRZScannerConfig` object we used to define the license, and will make use of some of the other parameters available in the `MRZScannerConfig` class.
@@ -283,7 +285,7 @@ public class MainActivity extends AppCompatActivity {
}
}
```
-1.
+2.
```kotlin
class MainActivity : AppCompatActivity() {
private lateinit var launcher: ActivityResultLauncher
diff --git a/programming/ios/api-reference/document-type.md b/programming/ios/api-reference/document-type.md
index f204ee5..3e88fc5 100644
--- a/programming/ios/api-reference/document-type.md
+++ b/programming/ios/api-reference/document-type.md
@@ -10,7 +10,7 @@ breadcrumbText: DSDocumentType
# DSDocumentType
-`DSDocumentType` is a enumeration class that defines the type of document to scan, such as ID cards or passports.
+`DSDocumentType` is an enumeration class that defines the type of document to scan, such as ID cards or passports.
## Definition
diff --git a/programming/ios/api-reference/mrz-data.md b/programming/ios/api-reference/mrz-data.md
index 35c3786..1f9bab7 100644
--- a/programming/ios/api-reference/mrz-data.md
+++ b/programming/ios/api-reference/mrz-data.md
@@ -33,21 +33,21 @@ class MRZData : NSObject
| Property | Type | Description |
| -------- | ------ | ----------- |
-| [`firstName`](#firstname) | String | The first name. |
-| [`lastName`](#lastname) | String | The last name. |
-| [`sex`](#sex) | String | The sex. |
-| [`issuingState`](#issuingstate) | String | The issuing state. |
-| [`nationality`](#nationality) | String | The nationality. |
-| [`dateOfBirth`](#dateofbirth) | String | The date of birth. |
-| [`dateOfExpire`](#dateofexpire) | String | The date of expire. |
-| [`documentType`](#documenttype) | String | The type of document. |
-| [`documentNumber`](#documentnumber) | String | The document number. |
-| [`age`](#age) | Int | The age. |
-| [`mrzText`](#mrztext) | String | The raw text of MRZ. |
+| [`firstName`](#firstname) | String | The first name of the user of the MRZ document. |
+| [`lastName`](#lastname) | String | The last name of the user of the MRZ document. |
+| [`sex`](#sex) | String | The sex of the user of the MRZ document. |
+| [`issuingState`](#issuingstate) | String | The issuing state of the MRZ document. |
+| [`nationality`](#nationality) | String | The nationality of the user of the MRZ document. |
+| [`dateOfBirth`](#dateofbirth) | String | The date of birth of the user of the MRZ document. |
+| [`dateOfExpire`](#dateofexpire) | String | The expiry date of the MRZ document. |
+| [`documentType`](#documenttype) | String | The type of MRZ document. |
+| [`documentNumber`](#documentnumber) | String | The MRZ document number. |
+| [`age`](#age) | Int | The age of the user of the MRZ document. |
+| [`mrzText`](#mrztext) | String | The raw text of the MRZ. |
### firstName
-The first name.
+The first name of the user of the MRZ document.
>- Objective-C
@@ -64,7 +64,7 @@ let firstName: String
### lastName
-The last name.
+The last name of the user of the MRZ document.
>- Objective-C
@@ -81,7 +81,7 @@ let lastName: String
### sex
-The sex.
+The sex of the user of the MRZ document.
>- Objective-C
@@ -98,7 +98,7 @@ let sex: String
### issuingState
-The issuing state.
+The issuing state of the MRZ document.
>- Objective-C
@@ -115,7 +115,7 @@ let issuingState: String
### nationality
-The nationality.
+The nationality of the user of the MRZ document.
>- Objective-C
@@ -132,7 +132,7 @@ let nationality: String
### dateOfBirth
-The date of birth.
+The date of birth of the user of the MRZ document.
>- Objective-C
@@ -149,7 +149,7 @@ let dateOfBirth: String
### dateOfExpire
-The date of expire.
+The expiry date of the MRZ document.
>- Objective-C
@@ -166,7 +166,7 @@ let dateOfExpire: String
### documentType
-The type of document.
+The type of MRZ document.
>- Objective-C
@@ -183,7 +183,7 @@ let documentType: String
### documentNumber
-The document number.
+The MRZ document number.
>- Objective-C
@@ -200,7 +200,7 @@ let documentNumber: String
### age
-The age.
+The age of the user of the MRZ document.
>- Objective-C
@@ -217,7 +217,7 @@ let age: Int
### mrzText
-The raw text of MRZ.
+The raw text of the MRZ.
>- Objective-C
diff --git a/programming/ios/api-reference/mrz-scan-result.md b/programming/ios/api-reference/mrz-scan-result.md
index 9492b61..cb05a3a 100644
--- a/programming/ios/api-reference/mrz-scan-result.md
+++ b/programming/ios/api-reference/mrz-scan-result.md
@@ -10,7 +10,7 @@ breadcrumbText: DSMRZScanResult
# DSMRZScanResult
-`DSMRZScanResult` is a result class that contains the parsed MRZ information from one scan and the additional information.
+`DSMRZScanResult` is a result class that contains the parsed MRZ information and the corresponding additional information.
## Definition
@@ -40,7 +40,7 @@ class MRZScanResult : NSObject
### data
-The parsed MRZ information.
+The parsed MRZ information as a [`MRZData`](mrz-data.md) object.
>- Objective-C
@@ -57,7 +57,7 @@ var data: MRZData {get}
### resultStatus
-The status of the result, which can be finished, canceled or exception.
+The status of the result represented as an [`EnumResultStatus`](result-status.md).
>- Objective-C
@@ -76,9 +76,9 @@ var resultStatus: ResultStatus {get}
The status of the result, which can be finished, canceled or exception.
-- `RS_FINISHED`: The MRZ scanning is finished.
-- `RS_CANCELED`: The MRZ scanning activity is closed before the process is finished.
-- `RS_EXCEPTION`: Failed to start MRZ scanning or an error occurs when scanning the MRZ.
+- `DSResultStatusFinished`: The MRZ scanning is finished.
+- `DSResultStatusCanceled`: The MRZ scanning activity is closed before the process is finished.
+- `DSResultStatusException`: Failed to start MRZ scanning or an error occurs when scanning the MRZ.
### errorCode
@@ -97,10 +97,6 @@ The error code should something go wrong during the MRZ scanning process.
var errorCode: Int { get }
```
-**Return Value**
-
-An integer representing a `DSErrorCode`.
-
### errorString
The error message associated with the error code should something go wrong during the MRZ scanning process.
diff --git a/programming/ios/api-reference/mrz-scanner-config.md b/programming/ios/api-reference/mrz-scanner-config.md
index 848d0b4..240c48a 100644
--- a/programming/ios/api-reference/mrz-scanner-config.md
+++ b/programming/ios/api-reference/mrz-scanner-config.md
@@ -10,7 +10,7 @@ breadcrumbText: MRZScannerConfig
# MRZScannerConfig
-`MRZScannerConfig` is the class that defines the configurations for MRZ scanning. It is set via the input value of `MRZScannerActivity.ResultContract`
+`MRZScannerConfig` is the class that defines the configurations for MRZ scanning. It is set via the `MRZScannerViewController`.
## Definition
@@ -33,17 +33,17 @@ class MRZScannerConfig : NSObject
| Property | Type | Description |
| -------- | ---- | ----------- |
-| [`license`](#license) | *NSString* | Sets/Gets the license string. |
-| [`templateFilePath`](#templatefilepath) | *NSString* | Sets/Gets a path for the SDK to load template file. |
-| [`documentType`](#documenttype) | *NSString* | Sets/Gets the document type to scan. |
-| [`isTorchButtonVisible`](#istorchbuttonvisible) | *BOOL* | Sets/Gets the visibility of the torch button. |
-| [`isBeepEnabled`](#isbeepenabled) | *BOOL* | Sets/Gets whether to trigger a beep sound when a MRZ is scanned. |
-| [`isCloseButtonVisible`](#isclosebuttonvisible) | *BOOL* | Sets/Gets the visibility of the close button. |
-| [`isGuideFrameVisible`](#isguideframevisible) | *BOOL* | Sets/Gets the visibility of the guide frame. |
+| [`license`](#license) | *NSString* | Sets/Returns the license string. |
+| [`templateFilePath`](#templatefilepath) | *NSString* | Sets/Returns the local file path for the JSON parameters template file. |
+| [`documentType`](#documenttype) | *NSString* | Sets/Returns the document type to scan, such as ID cards or passports. |
+| [`isTorchButtonVisible`](#istorchbuttonvisible) | *BOOL* | Sets/Returns the visibility of the torch button. |
+| [`isBeepEnabled`](#isbeepenabled) | *BOOL* | Sets/Returns whether the beep sound is enabled when a MRZ is scanned. |
+| [`isCloseButtonVisible`](#isclosebuttonvisible) | *BOOL* | Sets/Returns the visibility of the close button. |
+| [`isGuideFrameVisible`](#isguideframevisible) | *BOOL* | Sets/Returns the visibility of the guide frame on the display. |
### license
-Sets or gets the license string.
+Sets or returns the license string.
>- Objective-C
@@ -60,7 +60,7 @@ var license: String { get set }
### templateFilePath
-Sets or gets a path for the SDK to load template file.
+Sets or returns the local file path for the JSON parameters template file.
>- Objective-C
@@ -77,7 +77,7 @@ var templateFilePath: String { get set }
### documentType
-Sets or gets the document type to scan.
+Sets or returns the document type to scan, such as ID cards or passports.
>- Objective-C
@@ -94,7 +94,7 @@ var documentType: DocumentType { get set }
### isTorchButtonVisible
-Sets or gets the visibility of the torch button.
+Sets or returns the visibility of the torch button. Users can click the torch button to turn on/off the torch.
>- Objective-C
@@ -111,7 +111,7 @@ var isTorchButtonVisible: Bool { get set }
### isBeepEnabled
-Sets or gets the status of the beep sound setting.
+Sets or returns whether the beep sound is enabled when a MRZ is scanned.
>- Objective-C
@@ -128,7 +128,7 @@ var isBeepEnabled: Bool { get set }
### isCloseButtonVisible
-Sets or gets the visibility of the close button.
+Sets or returns the visibility of the close button.
>- Objective-C
@@ -145,7 +145,7 @@ var isCloseButtonVisible: Bool { get set }
### isGuideFrameVisible
-Sets or gets the visibility of the guide frame.
+Sets or returns the visibility of the guide frame on the display.
>- Objective-C
diff --git a/programming/ios/api-reference/mrz-scanner-view-controller.md b/programming/ios/api-reference/mrz-scanner-view-controller.md
index ab93f41..76f6501 100644
--- a/programming/ios/api-reference/mrz-scanner-view-controller.md
+++ b/programming/ios/api-reference/mrz-scanner-view-controller.md
@@ -10,7 +10,7 @@ breadcrumbText: MRZScannerViewController
# Class MRZScannerViewController
-`MRZScannerViewController` is an activity class that implements MRZ scanning features.
+`MRZScannerViewController` is an extension of the `ViewController` class that implements MRZ scanning features.
## Definition
@@ -29,6 +29,47 @@ breadcrumbText: MRZScannerViewController
class MRZScannerViewController: UIViewController
```
+## Properties
+
+| Property | Type | Description |
+| -------- | ---- | ----------- |
+| [`config`](#config) | *DSMRZScannerConfig \** | Sets or returns the MRZ scanner configurations. |
+| [`onScannedResult`](#onscannedresult) | *void (^)(DSMRZScanResult *)* | A property that holds a Block. The block is a callback that takes a single parameter of type `DSMRZScanResult` and returns no value. |
+
+## config
+
+Sets or returns the MRZ scanner configurations of type [`DSMRZScannerConfig`](mrz-scanner-config.md).
+
+
+>- Objective-C
+>- Swift
+>
+>1.
+```objc
+@property (nonatomic, strong, readwrite) DSMRZScannerConfig * config
+```
+2.
+```swift
+var config: MRZScannerConfig = .init()
+```
+
+## onScannedResult
+
+A property that holds a Block. The block is a callback that takes a single parameter of type [`DSMRZScanResult`](mrz-scan-result.md) and returns no value.
+
+
+>- Objective-C
+>- Swift
+>
+>1.
+```objc
+@property (nonatomic, copy, readwrite) void (^)(DSMRZScanResult *) onScannedResult
+```
+2.
+```swift
+var onScannedResult: ((MRZScanResult) -> Void)?
+```
+
## How to Use
diff --git a/programming/ios/user-guide/index.md b/programming/ios/user-guide/index.md
index a91066a..ab6d4ec 100644
--- a/programming/ios/user-guide/index.md
+++ b/programming/ios/user-guide/index.md
@@ -16,15 +16,15 @@ This user guide will walk through the [ScanMRZ](https://github.com/Dynamsoft/mrz
## Supported Machine-Readable Travel Document Types
-The Machine Readable Travel Documents (MRTD) standard specified by the International Civil Aviation Organization (ICAO) defines how to encode information for optical character recognition on official travel documents.
+The Machine Readable Travel Document (MRTD) standard specified by the International Civil Aviation Organization (ICAO) defines how to encode information for optical character recognition on official travel documents.
Currently, the SDK supports three types of MRTD:
-> Note: If you need support for other types of MRTDs, our SDK can be easily customized. Please contact the [Dynamsoft Support Team](https://www.dynamsoft.com/contact/).
+> Note: If you need support for other types of MRTDs, our SDK can be easily customized. Please contact the [Dynamsoft Support Team](https://www.dynamsoft.com/contact/) if you have such a request.
### ID (TD1 Size)
-The MRZ (Machine Readable Zone) in TD1 format consists of 3 lines, each containing 30 characters.
+The MRZ (Machine Readable Zone) in TD1 format consists of 3 lines with 30 characters in each line.
@@ -32,7 +32,7 @@ The MRZ (Machine Readable Zone) in TD1 format consists of 3 lines, each containi
### ID (TD2 Size)
-The MRZ (Machine Readable Zone) in TD2 format consists of 2 lines, with each line containing 36 characters.
+The MRZ (Machine Readable Zone) in TD2 format consists of 2 lines with 36 characters in each line.
@@ -40,7 +40,7 @@ The MRZ (Machine Readable Zone) in TD2 format consists of 2 lines, with each li
### Passport (TD3 Size)
-The MRZ (Machine Readable Zone) in TD3 format consists of 2 lines, with each line containing 44 characters.
+The MRZ (Machine Readable Zone) in TD3 format consists of 2 lines with 44 characters in each line.
@@ -50,7 +50,7 @@ The MRZ (Machine Readable Zone) in TD3 format consists of 2 lines, with each lin
- Supported OS: **iOS 11** or higher (**iOS 13** and higher recommended).
- Supported ABI: **arm64** and **x86_64**.
-- Development Environment: **Xcode 13** and above (Xcode 14.1+ recommended).
+- Development Environment: **Xcode 13** and above (**Xcode 14.1+** recommended).
## Add the SDK
@@ -64,7 +64,7 @@ There are two ways in which you can include the `DynamsoftMRZScanner` library in
3. Select `mrz-scanner-spm`, choose `Exact version`, enter **2.0.0**, then click **Add Package**.
-4. Check all the **xcframeworks** and add.
+4. Check all the **xcframeworks** and add them.
### Option 2: Add the Frameworks via CocoaPods
@@ -101,133 +101,133 @@ The first thing that we are going to do is to create a fresh new project. Here a
## Step 2: Include the Library
-Add the SDK to your new project. Please read [Add the SDK](#add-the-sdk) section for more details.
+Please read [Add the SDK](#add-the-sdk) section for instructions on how to add the SDK to your iOS application.
## Step 3: Initialize the License
-1. Add your code for initializing the license
+The first major step in code configuration is to include a valid license in the `MRZScannerConfig`, which is used when launching the scanner. Let's break it down into two smaller steps:
- In the *ViewController* code, there will be a single button that will start the operation as well as a label where the parsed MRZ information will be displayed as they are being scanned.
+1. In the *ViewController* code, there will be a single button that will start the operation and a label where the error message will be displayed should something go wrong during the capture process. In order to store the parsed MRZ information, we will also create a data struct with the necessary fields as show in the below code snippet.
The first step in code configuration is to include a valid license in the `MRZScannerConfig` object, which is used when launching the scanner.
-
- >- Objective-C
- >- Swift
- >
- >1.
- ```objc
- #import "ViewController.h"
- #import
- #import
- #import
- @interface ViewController ()
- @property (nonatomic, strong) UIButton *button;
- @property (nonatomic, strong) UILabel *label;
- @end
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setup];
- }
- - (void)buttonTapped {
- DSMRZScannerViewController *vc = [[DSMRZScannerViewController alloc] init];
- DSMRZScannerConfig *config = [[DSMRZScannerConfig alloc] init];
- config.license = @"DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
- vc.config = config;
- }
- - (void)setup {
- self.button = [UIButton buttonWithType:UIButtonTypeSystem];
- self.button.backgroundColor = [UIColor blackColor];
- [self.button setTitle:@"Scan MRZ" forState:UIControlStateNormal];
- [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- self.button.layer.cornerRadius = 8;
- self.button.clipsToBounds = YES;
- [self.button addTarget:self action:@selector(buttonTapped) forControlEvents:UIControlEventTouchUpInside];
- self.button.translatesAutoresizingMaskIntoConstraints = NO;
- [self.view addSubview:self.button];
- self.label = [[UILabel alloc] init];
- self.label.numberOfLines = 0;
- self.label.textColor = [UIColor blackColor];
- self.label.textAlignment = NSTextAlignmentCenter;
- self.label.font = [UIFont systemFontOfSize:20];
- self.label.translatesAutoresizingMaskIntoConstraints = NO;
- [self.view addSubview:self.label];
- UILayoutGuide *safeArea = self.view.safeAreaLayoutGuide;
- [NSLayoutConstraint activateConstraints:@[
- [self.button.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
- [self.button.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:50],
- [self.button.heightAnchor constraintEqualToConstant:50],
- [self.button.widthAnchor constraintEqualToConstant:150],
- [self.label.centerXAnchor constraintEqualToAnchor:safeArea.centerXAnchor],
- [self.label.centerYAnchor constraintEqualToAnchor:safeArea.centerYAnchor],
- [self.label.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor constant:30],
- [self.label.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor constant:-30]
- ]];
+
+>- Objective-C
+>- Swift
+>
+>1.
+```objc
+#import "ViewController.h"
+#import
+#import
+#import
+@interface ViewController ()
+@property (nonatomic, strong) UIButton *button;
+@property (nonatomic, strong) UILabel *label;
+@end
+@implementation ViewController
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ [self setup];
+}
+- (void)buttonTapped {
+ DSMRZScannerViewController *vc = [[DSMRZScannerViewController alloc] init];
+ DSMRZScannerConfig *config = [[DSMRZScannerConfig alloc] init];
+ config.license = @"DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
+ vc.config = config;
+}
+- (void)setup {
+ self.button = [UIButton buttonWithType:UIButtonTypeSystem];
+ self.button.backgroundColor = [UIColor blackColor];
+ [self.button setTitle:@"Scan MRZ" forState:UIControlStateNormal];
+ [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+ self.button.layer.cornerRadius = 8;
+ self.button.clipsToBounds = YES;
+ [self.button addTarget:self action:@selector(buttonTapped) forControlEvents:UIControlEventTouchUpInside];
+ self.button.translatesAutoresizingMaskIntoConstraints = NO;
+ [self.view addSubview:self.button];
+ self.label = [[UILabel alloc] init];
+ self.label.numberOfLines = 0;
+ self.label.textColor = [UIColor blackColor];
+ self.label.textAlignment = NSTextAlignmentCenter;
+ self.label.font = [UIFont systemFontOfSize:20];
+ self.label.translatesAutoresizingMaskIntoConstraints = NO;
+ [self.view addSubview:self.label];
+ UILayoutGuide *safeArea = self.view.safeAreaLayoutGuide;
+ [NSLayoutConstraint activateConstraints:@[
+ [self.button.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
+ [self.button.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:50],
+ [self.button.heightAnchor constraintEqualToConstant:50],
+ [self.button.widthAnchor constraintEqualToConstant:150],
+ [self.label.centerXAnchor constraintEqualToAnchor:safeArea.centerXAnchor],
+ [self.label.centerYAnchor constraintEqualToAnchor:safeArea.centerYAnchor],
+ [self.label.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor constant:30],
+ [self.label.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor constant:-30]
+ ]];
+}
+@end
+```
+2.
+```swift
+import UIKit
+import DynamsoftLicense
+import DynamsoftMRZScannerBundle
+class ViewController: UIViewController {
+ let button = UIButton()
+ let label = UILabel()
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ setup()
}
- @end
- ```
- 1.
- ```swift
- import UIKit
- import DynamsoftLicense
- import DynamsoftMRZScannerBundle
- class ViewController: UIViewController {
- let button = UIButton()
- let label = UILabel()
- override func viewDidLoad() {
- super.viewDidLoad()
- setup()
- }
- @objc func buttonTapped() {
- let vc = MRZScannerViewController()
- let config = MRZScannerConfig()
- config.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"
- vc.config = config
- }
- /* CONTINUATION OF CODE FROM STEP 3 AND 4 */
- func setup() {
- button.backgroundColor = .black
- button.setTitle("Scan MRZ", for: .normal)
- button.setTitleColor(.white, for: .normal)
- button.layer.cornerRadius = 8
- button.clipsToBounds = true
- button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
- button.translatesAutoresizingMaskIntoConstraints = false
- view.addSubview(button)
- label.numberOfLines = 0
- label.textColor = .black
- label.textAlignment = .center
- label.font = UIFont.systemFont(ofSize: 20)
- label.translatesAutoresizingMaskIntoConstraints = false
- view.addSubview(label)
- let safeArea = view.safeAreaLayoutGuide
- NSLayoutConstraint.activate([
- button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
- button.topAnchor.constraint(equalTo: safeArea.topAnchor, constant: 50),
- button.heightAnchor.constraint(equalToConstant: 50),
- button.widthAnchor.constraint(equalToConstant: 150),
- label.centerXAnchor.constraint(equalTo: safeArea.centerXAnchor),
- label.centerYAnchor.constraint(equalTo: safeArea.centerYAnchor),
- label.leadingAnchor.constraint(equalTo: safeArea.leadingAnchor, constant: 30),
- label.trailingAnchor.constraint(equalTo: safeArea.trailingAnchor, constant: -30)
- ])
- }
+ @objc func buttonTapped() {
+ let vc = MRZScannerViewController()
+ let config = MRZScannerConfig()
+ config.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"
+ vc.config = config
+ }
+ func setup() {
+ button.backgroundColor = .black
+ button.setTitle("Scan MRZ", for: .normal)
+ button.setTitleColor(.white, for: .normal)
+ button.layer.cornerRadius = 8
+ button.clipsToBounds = true
+ button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
+ button.translatesAutoresizingMaskIntoConstraints = false
+ view.addSubview(button)
+ label.numberOfLines = 0
+ label.textColor = .black
+ label.textAlignment = .center
+ label.font = UIFont.systemFont(ofSize: 20)
+ label.translatesAutoresizingMaskIntoConstraints = false
+ view.addSubview(label)
+ let safeArea = view.safeAreaLayoutGuide
+ NSLayoutConstraint.activate([
+ button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
+ button.topAnchor.constraint(equalTo: safeArea.topAnchor, constant: 50),
+ button.heightAnchor.constraint(equalToConstant: 50),
+ button.widthAnchor.constraint(equalToConstant: 150),
+ label.centerXAnchor.constraint(equalTo: safeArea.centerXAnchor),
+ label.centerYAnchor.constraint(equalTo: safeArea.centerYAnchor),
+ label.leadingAnchor.constraint(equalTo: safeArea.leadingAnchor, constant: 30),
+ label.trailingAnchor.constraint(equalTo: safeArea.trailingAnchor, constant: -30)
+ ])
}
- ```
+}
+```
>Note:
>
>- The license string here grants a time-limited free trial which requires network connection to work.
>- You can request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=mrz&utm_source=guide&package=ios){:target="_blank"} link.
+ >- The *setup* method is used to define the properties of the UI elements (label, button) via the code instead of configuring them via the storyboard. It is called in `viewDidLoad` to ensure that these settings are applied once the app is opened.
2. Configure *NavigationController*
- The license is initialized in another view. As a result, we must first define a couple of essential elements of the storyboard and the associated views that are required. We will only have one *ViewController*, with an associated *NavigationController* to allow the user to navigate back and forth from the home page to the main *ViewController* where the MRZ Scanner will operate.
+ We will only have one *ViewController*, where most of the code will be written including the license initialization, along with an associated *NavigationController* to allow the user to navigate back and forth from the home page to the main *ViewController* where the MRZ Scanner will operate.
## Step 4: Implementing the MRZ Scanner
-Now that the license is configured and the license has been set, it is time to implement the actions to take when an MRZ is scanned via the `onScannedResult` callback function. The callback function is triggered whenever an MRZ is scanned successfully, so we must implement the code that will display the parsed MRZ information in the *label* that we previously defined.
+Now that the license is configured and set, it is time to implement the actions to take when an MRZ is scanned via the `onScannedResult` callback function. The callback function is triggered whenever an MRZ is scanned, so we must implement the code that will display the parsed MRZ information in the *label* that we previously defined.
Each result comes with a `DSResultStatus` that can be one of *finished*, *canceled*, or *exception*. The first, *finished*, indicates that the result has been parsed and is available - while *canceled* indicates that the operation has been halted. If *exception* is the result status, then that means that an error has occurred during the MRZ scanning process. So let us now continue the code of the `buttonTapped` method from step 3:
@@ -242,7 +242,7 @@ Each result comes with a `DSResultStatus` that can be one of *finished*, *cancel
DSMRZScannerViewController *vc = [[DSMRZScannerViewController alloc] init];
DSMRZScannerConfig *config = [[DSMRZScannerConfig alloc] init];
config.license = @"DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
- // some other settings
+ // Extra configurations from step 5 go here
vc.config = config;
__weak typeof(self) weakSelf = self;
vc.onScannedResult = ^(DSMRZScanResult *result) {
@@ -263,7 +263,7 @@ Each result comes with a `DSResultStatus` that can be one of *finished*, *cancel
}
case DSResultStatusException: {
dispatch_async(dispatch_get_main_queue(), ^{
- weakSelf.label.text = result.errorString;
+ weakSelf.label.text = result.errorString;
});
break;
}
@@ -280,56 +280,54 @@ Each result comes with a `DSResultStatus` that can be one of *finished*, *cancel
});
}
```
-1.
+2.
```swift
-class ViewController: UIViewController {
- /* CONTINUATION OF CODE FROM STEP 3 */
- @objc func buttonTapped() {
- let vc = MRZScannerViewController()
- let config = MRZScannerConfig()
- config.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"
- // some other settings
- vc.config = config
- vc.onScannedResult = { [weak self] result in
- guard let self = self else { return }
- switch result.resultStatus {
- /* if the result is valid, display it in the label */
- case .finished:
- DispatchQueue.main.async {
- let documentType = result.data?.documentType ?? ""
- let documentNumber = result.data?.documentNumber ?? ""
- self.label.text = "Result:\nDocumentType: " + (documentType) + "\n" + "DocumentNumber: " + (documentNumber)
- }
- /* if the scan operation is canceled by the user */
- case .canceled:
- DispatchQueue.main.async {
- self.label.text = "Scan canceled"
- }
- /* if an error occurs during capture, display the error string in the label */
- case .exception:
- DispatchQueue.main.async {
- self.label.text = result.errorString
- }
- @unknown default:
- break
+/* CONTINUATION OF CODE FROM STEP 3 */
+@objc func buttonTapped() {
+ let vc = MRZScannerViewController()
+ let config = MRZScannerConfig()
+ config.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"
+ // Extra configurations from step 5 go here
+ vc.config = config
+ vc.onScannedResult = { [weak self] result in
+ guard let self = self else { return }
+ switch result.resultStatus {
+ /* if the result is valid, display it in the label */
+ case .finished:
+ DispatchQueue.main.async {
+ let documentType = result.data?.documentType ?? ""
+ let documentNumber = result.data?.documentNumber ?? ""
+ self.label.text = "Result:\nDocumentType: " + (documentType) + "\n" + "DocumentNumber: " + (documentNumber)
+ }
+ /* if the scan operation is canceled by the user */
+ case .canceled:
+ DispatchQueue.main.async {
+ self.label.text = "Scan canceled"
}
- /* return back to the home page to display the result/cancel message/error string */
+ /* if an error occurs during capture, display the error string in the label */
+ case .exception:
DispatchQueue.main.async {
- self.navigationController?.popViewController(animated: true)
+ self.label.text = result.errorString
}
+ @unknown default:
+ break
}
- /* when the button is clicked, hide the navigation bar and push the newly created MRZScannerViewController to the main view */
+ /* return back to the home page to display the result/cancel message/error string */
DispatchQueue.main.async {
- self.navigationController?.navigationBar.isHidden = true
- self.navigationController?.pushViewController(vc, animated: true)
+ self.navigationController?.popViewController(animated: true)
}
}
+ /* when the button is clicked, hide the navigation bar and push the newly created MRZScannerViewController to the main view */
+ DispatchQueue.main.async {
+ self.navigationController?.navigationBar.isHidden = true
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
}
```
## Step 5: Configure the MRZ Scanner (optional)
-This next step, although optional, is highly recommended to help you achieve a smooth-looking UI. In this step, we will configure the `setup` method that was called in `viewDidLoad`. In `setup` we will define the styles of different UI elements including the main "Scan MRZ" button as well as the results label. Please note that this UI setup can also be done directly in the *Main.storyboard* but in this guide we opted to have the entire configuration done via the code.
+This next step, although optional, is highly recommended to help you achieve a smooth-looking UI. In this step, we will configure the `MRZScannerConfig` object to utilize some of the other properties that are available in the class. In step 3, `MRZScannerConfig` was initially used to configure the license. Now, let's use some of the other settings which include the document type, the visibility of the torch button, and whether a beep should be played after a successful recognition.
>- Objective-C
@@ -349,7 +347,7 @@ config.isTorchButtonVisible = false;
// Add the following line if you don't want to display the close button.
config.isCloseButtonVisible = false;
```
-1.
+2.
```swift
let config = MRZScannerConfig()
// You can use the following code to specify the document type.
@@ -364,6 +362,9 @@ config.isTorchButtonVisible = false
config.isCloseButtonVisible = false
```
+>Note:
+>The code above only shows the configuration of the MRZScannerConfig object, which takes place right at the beginning of the `buttonTapped` function in steps 3 and 4.
+
## Step 6: Run the Project
Now that the code has been written, it's time to run the project. The first thing that needs to be done is to configure the *Signing & Capabilities* section of the project. After you complete this section, move to the *Info* section of the project settings. In the *Info* section, please make sure that the "Privacy - Camera Usage Description" key is included in the list.