Label Field Definition
Defined in framework ScanditLabelCapture
- LabelFieldDefinition
open class LabelFieldDefinition : NSObject
Added in version 6.21.0
Base class for defining fields within a label. Label field definitions specify the expected content, validation patterns, and constraints for individual data elements that make up a label structure.
Field definitions are used within LabelDefinition objects to describe the composition of labels, including what types of data to expect (barcodes, text, dates) and how to validate that data.
- setPattern
open func setPattern(_ pattern: String) ->
VoidAdded in version 6.21.0
Sets a regular expression pattern to validate the content of this field. This pattern will be used to ensure that captured data matches the expected format for your specific use case.
- name
open var name: String { get }
Added in version 6.21.0
The unique identifier for this field within the label definition. This name is used to reference the field when processing captured results and must be unique within the label definition.
- patterns
open var patterns: Array<String> { get, set }
Added in version 6.21.0
Regular expression patterns used to validate captured content. These patterns allow you to ensure that the captured data matches the expected format for your specific field type.
For example, you can use patterns like [“\d{2}/\d{2}/\d{4}”] for date formats, or [“[A-Z]{2}\d{6}”] for codes that must start with two letters followed by six digits.
- hiddenProperties
open var hiddenProperties: Dictionary<AnyHashable,
Any> { get, set }Added in version 6.21.0
Internal configuration properties used for advanced field customization. These properties are not part of the public API and are used internally by the SDK for field configuration.
- optional
open var optional:
Bool{ get, set }Added in version 6.21.0
Determines whether this field is required for the label to be considered complete. When set to true, the label can be marked as complete even if this field is not found. When false (mandatory), the label will only be complete when this field is successfully captured.
Optional fields are useful for scenarios where certain information might not always be present on labels, such as promotional codes or secondary identifiers.
- numberOfMandatoryInstances
open var numberOfMandatoryInstances: NSNumber? { get, set }
Added in version 7.5.0
The minimum number of instances of this field that must be captured for the label to be considered complete. This is useful for fields that may appear multiple times on a label, such as multiple serial numbers or repeated information.