Label Capture Advanced Overlay
Defined in framework ScanditLabelCapture
- LabelCaptureAdvancedOverlay
open class LabelCaptureAdvancedOverlay : UIView, DataCaptureOverlay
Added in version 6.16.0
An advanced overlay for DataCaptureView that enables rich AR-style experiences by allowing custom views to be anchored to captured labels and their individual fields (label location is only supported in some use cases at the moment).
This overlay provides sophisticated augmented reality capabilities, allowing you to create dynamic AR elements that react to captured label content. The provided views maintain their relative position to labels and fields as they move in the camera preview, enabling real-time contextual information display.
Advanced AR use cases include:
Dynamic warnings - Display alerts for items near expiration based on captured dates
Contextual information - Show additional product details or pricing information
Field-specific feedback - Provide targeted visual feedback for individual label fields
Custom validation indicators - Create sophisticated validation interfaces
The overlay supports both label-level and field-level view anchoring, providing fine-grained control over AR element positioning and behavior.
To display the views, this overlay must be attached to a DataCaptureView. This may be done either by creating it with init() with a non-null view parameter or by passing this overlay to DataCaptureView.addOverlay().
A user of this class may configure what view is displayed for the given label and the relative position between the two by implementing LabelCaptureAdvancedOverlayDelegate.
- init
convenience init(labelCapture: LabelCapture, view: DataCaptureView?)
Added in version 6.16.0
Constructs a new overlay to visualize the process of label capture. When view is non-null, the overlay is automatically added to the view. Otherwise, the overlay needs to be added through a call to DataCaptureView.addOverlay().
- init
convenience init(jsonString JSONString: String, labelCapture mode: LabelCapture) throws
Added in version 6.16.0
Constructs a new label capture advanced overlay with the provided JSON serialization.
For the overlay to be displayed on screen, it must be added to a DataCaptureView.
- delegate
open weak var delegate: LabelCaptureAdvancedOverlayDelegate? { get, set }
Added in version 6.16.0
The listener which is called whenever a view, an anchor point and an offset must be defined for a tracked CapturedLabel.
- shouldShowScanAreaGuides
open var shouldShowScanAreaGuides:
Bool{ get, set }Added in version 6.16.0
Whether to show scan area guides on top of the preview. This property is useful during development to visualize the current scan areas on screen. It is not meant to be used for production. By default this property is false.
- setView
open func setView(_ view: UIView?, for capturedLabel: CapturedLabel) ->
VoidAdded in version 6.16.0
The method can be called to change the view drawn for the given tracked label. Setting the view to null will unset the view from the tracked label and will effectively remove it from the overlay. This method is thread-safe, it can be called from any thread. The view set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay(): in case a view is set before LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() got called, no call to LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() will happen.
- setAnchor
open func setAnchor(_ anchor: Anchor, for capturedLabel: CapturedLabel) ->
VoidAdded in version 6.16.0
The method can be called to change the anchor point for the view associated with the given tracked label. This method is thread-safe, it can be called from any thread. The anchor set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay(): in case a view is set before LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() got called, no call to LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() will happen.
- setOffset
open func setOffset(_ offset: PointWithUnit, for capturedLabel: CapturedLabel) ->
VoidAdded in version 6.16.0
The method can be called to change the offset for the view associated with the given tracked label. This method is thread-safe, it can be called from any thread. The offset set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay(): in case a view is set before LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() got called, no call to LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() will happen. If the MeasureUnit of the offset is MeasureUnit.fraction, the offset is calculated relative to view’s dimensions.
- setView
open func setView(_ view: UIView?, for field: LabelField, of capturedLabel: CapturedLabel) ->
VoidAdded in version 6.17.0
The method can be called to change the view drawn for the given tracked field of the captured label. Setting the view to null will unset the view from the tracked field of the captured label and will effectively remove it from the overlay. This method is thread-safe, it can be called from any thread. The view set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay(): in case a view is set before LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() got called, no call to LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() will happen.
- setAnchor
open func setAnchor(_ anchor: Anchor, for field: LabelField, of capturedLabel: CapturedLabel) ->
VoidAdded in version 6.17.0
The method can be called to change the anchor point for the view associated with the given tracked field of the captured label. This method is thread-safe, it can be called from any thread. The anchor set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay(): in case a view is set before LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() got called, no call to LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() will happen.
- setOffset
open func setOffset(_ offset: PointWithUnit, for field: LabelField, of capturedLabel: CapturedLabel) ->
VoidAdded in version 6.17.0
The method can be called to change the offset for the view associated with the given tracked field of the captured label. This method is thread-safe, it can be called from any thread. The offset set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay(): in case a view is set before LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() got called, no call to LabelCaptureAdvancedOverlayDelegate.labelCaptureAdvancedOverlay() will happen. If the MeasureUnit of the offset is MeasureUnit.fraction, the offset is calculated relative to view’s dimensions.
- clearTrackedCapturedLabelViews
open func clearTrackedCapturedLabelViews() ->
VoidAdded in version 6.16.0
Clears all the views for the currently tracked labels from this overlay. This method is thread-safe, it can be called from any thread.