Skip to main content

AilaScanObject

Since 3.0.0

Base object representing a scanned barcode.

Declaration​

@interface AilaScanObject : NSObject
@property (nonatomic) AilaCodeType type;
@property (nonatomic) NSString *data;
- (NSString *)typeDescription;
@end

Description​

This object is returned as part of the scanCallback upon a successful scan, and contains the type and data of the scan.

Properties​

type​

Since 3.0.0

An enum representing the barcode symbology.

Type: AilaCodeType

Example values: AilaCodeTypeQR, AilaCodeType128, AilaCodeTypeUPC, etc.

data​

Since 3.0.0

The data contained inside the barcode.

Type: NSString / String

For a UPC-A code "123456789999", this property would contain the string "123456789999".

Methods​

typeDescription​

Since 3.0.0

Returns the descriptive text for the barcode symbology.

Returns: NSString / String

For example, for AilaCodeTypeQR, this returns "QR".

Usage Example​

config.scanCallback = ^(NSArray<AilaScanObject *> *results) {
for (AilaScanObject *scan in results) {
// Get type enum
AilaCodeType type = scan.type;

// Get human-readable type
NSString *typeStr = [scan typeDescription];

// Get barcode data
NSString *data = scan.data;

NSLog(@"Scanned %@ barcode: %@", typeStr, data);

// Check for specific type
if (type == AilaCodeTypeQR) {
NSLog(@"This is a QR code");
}
}
};

Subclasses​

See Also​