Quickstart
The iOS SDK is available as a Swift Package Manager (SPM) dependency.
Installation
1. Add Package Dependency
In Xcode, go to File > Add Package Dependencies... and enter the package repository URL:
https://github.com/Mobaibio/mobai-ios-sdk
2. Select Package Products
Select the following products from the package:
MobaiNfc- The core NFC reading module
3. Configure Info.plist
Add the following keys to your Info.plist to enable NFC reading capabilities:
<key>NFCReaderUsageDescription</key>
<string>This app needs NFC access to read travel documents</string>
4. Configure Entitlements
Ensure your app's entitlements file includes NFC capabilities:
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
<string>TAG</string>
</array>
5. Import the Module
In your Swift files where you need NFC functionality:
import MobaiNfc
import CoreNFC
License Setup
The SDK requires a valid license file. Add your iengine.lic file to your app bundle:
- Drag the license file into your Xcode project
- Ensure it's added to your app target
- The license will be loaded from the bundle at runtime
Basic Usage
The NFC reading functionality is typically used in conjunction with document reading. After capturing a document and extracting MRZ data, you can use that data to read the NFC chip.
import MobaiNfc
import MobaiDocument
// Initialize the NFC reading executor with your license
let license = try LicenseHelper.loadLicense()
let nfcReadingExecutor = MBDocumentReadingServiceNfc(license: license)
nfcReadingExecutor.delegate = self
// Start NFC reading with document results
let results = MBResults(
documentNumber: "FHC002594",
dateOfExpiry: "250612",
dateOfBirth: "560423"
)
nfcReadingExecutor.execute(result: results)
For detailed implementation instructions, see the Implementation Guide.
Sample Code
For complete working examples, refer to the iOS SDK Samples repository on GitHub.