API reference for barKoder's iOS Barcode Scanner SDK

BarkoderView #

The BarkoderView class is a part of the barKoder's iOS Barcode Scanner SDK. It includes methods to manage camera preview and barcode scanning operations. It allows you to set a delegate for preview frames, adjust the zoom factor, check the availability of flash, toggle flash on or off, start and stop the camera, and manage the scanning process. The scanning methods include startScanning, stopScanning, and pauseScanning. The class requires a result delegate for the startScanning method.

setPreviewFramesDelegate #

Set camera frames callback if you want to receive the frames/images only without decoding them and do your own work with the frames

                @objc public func setPreviewFramesDelegate(_ delegate:
BarkoderPreviewFramesDelegate?)
            

setZoomFactor #

Set the zoom factor for the camera preview

If a preview session is already active this zoom factor will be set only for this session, therefore initial zoom will be set

every next preview session is started with this zoom factor

                @objc public func setZoomFactor(_ zoomFactor: Float)
            

isFlashAvailable #

Check if current mobile device has flash available

                @objc public func isFlashAvailable(_ completion: @escaping(_ flashAvailable: Bool) ->
Void)
            

setFlash #

Turn flash ON/OFF

If preview session is already active this state will be set only for active session otherwise the initial flash state is set. Every next preview session will be started with this state

@params enabled: [true,false].

Default value is false

                @objc public func setFlash(_ enabled: Bool)
            

startCamera #

Start the camera preview only, without decoding

                @objc public func startCamera()
            

startScanning #

Initiates the barcode scanning process, allowing the application to detect and decode barcodes from the device's camera feed.

@param resultDelegate

Throws Error if BarkoderView config is not set

                @objc public func startScanning(_ resultDelegate: BarkoderResultDelegate) throws
            

stopScanning #

Halts the barcode scanning process, stopping the camera from capturing and processing barcode information.

                @objc public func stopScanning()
            

pauseScanning #

Temporarily suspends the barcode scanning process, pausing the camera feed without completely stopping the scanning session.

                @objc public func pauseScanning()
            


freezeScanning #

Freezes the AR scanning session by capturing a still image from the camera feed while keeping AR overlays visible.

Available only when AR mode is enabled.

                @objc public func freezeScanning()
            

unfreezeScanning #

Unfreezes a previously frozen AR scanning session and resumes live camera scanning and overlay updates.

Available only when AR mode is enabled.

                @objc public func unfreezeScanning()
            

setCamera #

Sets which camera (front or back) is used for scanning.

Default camera is the back camera.

                @objc public func setCamera(_ position: BarkoderCameraPosition)
            

getMaxZoomFactor #

Asynchronously retrieves the maximum available zoom factor for the current camera.

                @objc public func getMaxZoomFactor(_ completion: @escaping(_ maxZoomFactor: Float) -> Void)
            

getCurrentZoomFactor #

Gets the current zoom factor if the camera is active, or the intended zoom factor that will be applied when the camera starts.

                @objc public func getCurrentZoomFactor() -> Float
            

setDynamicExposure #

Configures dynamic exposure compensation based on the provided intensity value.

A value between 0 and 10 is expected, where 0 disables dynamic exposure.

Default value is 0 (disabled).

                @objc public func setDynamicExposure(_ intensity: Int)
            

setCentricFocusAndExposure #

Configures the camera to use the center of the viewfinder for focus and exposure.

Default value is false.

                @objc public func setCentricFocusAndExposure(_ enabled: Bool)
            

setVideoStabilization #

Enables or disables video stabilization for the camera preview.

Default value is false.

                @objc public func setVideoStabilization(_ enabled: Bool)
            

captureImage #

Captures the latest available camera frame and returns it through the BarkoderResultDelegate scanningFinished callback (without decoding barcodes). Must be used after starting the camera with `startScanning()`.

                @objc public func captureImage()
            


BarkoderConfig #

The BarkoderConfig class in the barKoder's iOS Barcode Scanner SDK includes various properties and methods to configure the barcode scanning process.

It allows you to enable or disable barcode types, configure the color and width of the location line and region of interest line, and set the background color of the overlay within the Region of Interest.

It also offers options to adjust the scanning session, capture and process image data, display barcode location information, define and retrieve the Region of Interest, set the maximum threads used for decoding, enable pinch-to-zoom feature, and set the resolution for barcode scanning.

Furthermore, the class includes options to enable or disable sound and vibration upon successful decoding, adjust the threshold between duplicate scans, and enable multi-code caching. It also provides methods to export the config to a JSON string.

decoderConfig #

Obtain the decoder config object. This object allows you to enable or disable decoders (barcode types) and configure each one individually

                @objc public var decoderConfig: Config? = nil
            

decodingSpeed #

Decoding speed profile for barcode scanning. Options: Fast(0), Normal(1), Slow(2), Rigorous(3).

decoderConfig setting

                @objc public var decodingSpeed: DecodingSpeed
            

encodingCharacterSet #

Encoding character set used for decoding (e.g. “UTF-8”).

decoderConfig setting

                @objc public var encodingCharacterSet: String
            

formatting #

Formatting type for decoded data. Options: Disabled(0), Automatic(1), GS1(2), AAMVA(3), SADL(4).

decoderConfig setting

                @objc public var formatting: Formatting
            

maximumResultsCount #

Maximum number of results returned per scan.

decoderConfig setting

                @objc public var maximumResultsCount: Int
            

upcEanDeblur #

Enables deblurring for UPC/EAN barcodes.

decoderConfig setting

                @objc public var upcEanDeblur: Bool
            

enableMisshaped1D #

Enables detection of misshaped 1D barcodes.

decoderConfig setting

                @objc public var enableMisshaped1D: Bool
            

enableVINRestrictions #

Enables VIN-specific decoding restrictions.

decoderConfig setting

                @objc public var enableVINRestrictions: Bool
            

enableComposite #

Enables composite mode when scanning composite barcodes.

decoderConfig setting

                @objc public var enableComposite: Int
            

dpmMode #

Sets whether Direct Part Marking (DPM) mode is enabled. It's available for QR, Micro QR and Data Matrix barcodes. It only works efficiently with small ROI and camera - it is not efficient for images.

decoderConfig setting

                @objc public var dpmMode: Int
            

multiPartMerge #

Enables merging of multi-part QR codes into a single result (only returns when all parts are found).

decoderConfig setting

                @objc public var multiPartMerge: Bool
            

setCustomOption #

Sets a custom decoder option by key.

decoderConfig setting.

Supported options:

“single_line_scan” (1D only): 1 = vertical scan line in the middle, 2 = horizontal scan line in the middle. (scanningIndicator)

“center_only_scan” (1D & 2D): value = center region in %, e.g. 1 = exact center, 10 = 10% center area.

“upce_leading_zero”: 0 = to remove a leading 0 for UPC-E.

“decode_document_image_only”: 1 = capture a document image only (no barcode decoding).

                @objc public func setcustomOption(_ option: String, value: Int)
            

setLengthRangeWithMinimum(_:maximum:) #

Sets the allowed length range for a particular symbology.

decoderConfig setting.

checksum #

Controls checksum validation mode.

decoderConfig setting.

StandardChecksum: Disabled / Enabled

Code11Checksum: Disabled / Single / Double

Code39Checksum: Disabled / Enabled

MsiChecksum: Disabled / Mod10 / Mod11 / Mod1010 / Mod1110 / Mod11IBM / Mod1110IBM

locationLineColor #

Location line color as UIColor

                @objc public var locationLineColor: UIColor
            

locationLineWidth #

Get the location line width as float

Default value is 2.0

                @objc public var locationLineWidth: Float
            

roiLineColor #

Region of interest line color as UIColor

                @objc public var roiLineColor: UIColor
            

roiLineWidth #

Region of interest line width as float

Default value is 2.0

                @objc public var roiLineWidth: Float
            

roiOverlayBackgroundColor #

Sets the background color of the overlay within the Region of Interest (ROI) for barcode scanning on the camera feed.

                @objc public var roiOverlayBackgroundColor: UIColor
            

closeSessionOnResultEnabled #

Enables or disables the automatic closing of the scanning session upon detecting a barcode result

Default value is true

                @objc public var closeSessionOnResultEnabled: Bool
            


scanningIndicatorColor #

Color of the scanning indicator as UIColor.

                @objc public var scanningIndicatorColor: UIColor
            


scanningIndicatorWidth #

Scanning indicator line width as Float.

Default value is 2.0

                @objc public var scanningIndicatorWidth: Float
            


scanningIndicatorAnimation #

Scanning indicator animation mode as Int.

Default value is 0.

                @objc public var scanningIndicatorAnimation: Int
            

scanningIndicatorAlwaysVisible #

Sets whether the scanning indicator is always visible on the camera preview.

Default value is false.

                @objc public var scanningIndicatorAlwaysVisible: Bool
            


showDuplicatesLocations #

Controls whether duplicate barcode locations are shown on the camera preview when the same code is scanned multiple times.

Default value is true.

                @objc public var showDuplicatesLocations: Bool
            

imageResultEnabled #

Enables or disables the capturing and processing of image data when a barcode is successfully detected.

Image result is received in BarkoderResultDelegate as UIImage

Default value is false

                @objc public var imageResultEnabled: Bool
            

locationInImageResultEnabled #

Enables or disables the inclusion of barcode location information within the image data result

If enabled, barcode in the result image will be marked

Default value is false

                @objc public var locationInImageResultEnabled: Bool
            

locationInPreviewEnabled #

Enables or disables the display of barcode location information on the camera preview

Default value is true

                @objc public var locationInPreviewEnabled: Bool
            

setRegionOfInterest #

Defines the Region of Interest (ROI) on the camera preview for barcode scanning, specifying an area where the application focuses on detecting barcodes.

                @objc open func setRegionOfInterest(_ value: CGRect) throws
            

getRegionOfInterest #

Retrieves the region of interest (ROI)

Default value is CGRect(x: 3, y: 30, width: 94, height: 40)

                @objc open func getRegionOfInterest() -> CGRect
            

setThreadsLimit #

Set maximum threads that will be used for the decoding process

Parameter value: [1, max threads available].

Throws Error if input param is greater than maximum threads available on that device

                @objc func setThreadsLimit(_ value: Int) throws
            

getThreadsLimit #

Get maximum threads that are used for the decoding process

                @objc open func getThreadsLimit() -> Int
            

pinchToZoomEnabled #

Enables or disables the pinch-to-zoom feature for adjusting the zoom level during barcode scanning.

Default value is false

                @objc public var pinchToZoomEnabled: Bool
            

regionOfInterestVisible #

Retrieves/Sets the visibility of the Region of Interest (ROI) on the camera preview

Default value is true

                @objc public var regionOfInterestVisible: Bool
            

barkoderResolution #

Retrieve/Sets the resolution for barcode scanning.

It can be HD(High Definition), FHD(Full HD) or UHD(4k)

Default value is BarkoderView.BarkoderResolution.HD

                @objc public var barkoderResolution: BarkoderView.BarkoderResolution
            

beepOnSuccessEnabled #

Enables or disables the audible beep sound upon successfully decoding a barcode.

Default value is true

                @objc public var beepOnSuccessEnabled: Bool
            

vibrateOnSuccessEnabled #

Enables or disables the device vibration upon successfully decoding a barcode.

Default value is true

                @objc public var vibrateOnSuccessEnabled: Bool
            

barcodeThumbnailOnResult #

Retrieve/Sets whether to enable barcode thumbnail on result.

Default value is true

                @objc public var barcodeThumbnailOnResult: Bool
            

thresholdBetweenDuplicatesScans #

Retrieve/Sets the threshold between duplicate scans

Default value is 5

                @objc public var thresholdBetweenDuplicatesScans: Int
            

setMulticodeCachingEnabled #

Sets whether multi-code caching is enabled

                @objc open func setMulticodeCachingEnabled(_ boolean: Bool)
            

getMulticodeCachingEnabled #

Retrieves whether multi-code caching is enabled

                @objc open func getMulticodeCachingEnabled() -> Bool
            

setMulticodeCachingDuration #

Sets the caching duration (in milliseconds) for multi-code results

                @objc open func setMulticodeCachingDuration(_ value: Int)
            

getMulticodeCachingDuration #

Retrieves the caching duration (in milliseconds) for multi-code results

                @objc open func getMulticodeCachingDuration() -> Int
            

GetVersion #

                @objc public static func GetVersion() -> String
            


BarkoderARConfig #

arConfig #

Configuration options for AR barcode detection and overlay behavior.

                @objc public var arConfig: BarkoderARConfig
            

arMode #

Defines the overall AR behavior mode (interactive, non-interactive, or disabled).

Default value is off.

                @objc public var arMode: BarkoderARMode
            

resultDisappearanceDelayMs #

Time delay in milliseconds after which a detected barcode result is considered expired and removed from the AR view.

Default value is 800.

                @objc public var resultDisappearanceDelayMs: Int
            

locationTransitionSpeed #

Speed factor for smooth interpolation of overlay positions during camera movement (range 0.1 – 1.0).

Higher values mean faster transitions.

Default value is 0.3.

                @objc public var locationTransitionSpeed: Float
            

overlayRefresh #

Defines how often AR overlays are updated on the camera preview (e.g. smooth or normal refresh rate).

Default value is .smooth.

                @objc public var overlayRefresh: BarkoderAROverlayRefresh
            

selectedLocationColor #

Color used to draw overlays around selected barcodes in AR mode as UIColor.

                @objc public var selectedLocationColor: UIColor
            

nonSelectedLocationColor #

Color used to draw overlays around non-selected barcodes in AR mode as UIColor.

                @objc public var nonSelectedLocationColor: UIColor
            

selectedLocationLineWidth #

Line width of overlays drawn around selected barcodes.

Default value is 2.0.

                @objc public var selectedLocationLineWidth: Float
            

nonSelectedLocationLineWidth #

Line width of overlays drawn around non-selected barcodes.

Default value is 2.0.

                @objc public var nonSelectedLocationLineWidth: Float
            

locationType #

Specifies the type of AR location overlay drawn around barcodes (none, tight, or bounding box).

Default value is .boundingBox.

                @objc public var locationType: BarkoderARLocationType
            

doubleTapToFreezeEnabled #

Enables or disables the double-tap gesture to freeze/unfreeze barcode scanning in AR mode.

Default value is true.

                @objc public var doubleTapToFreezeEnabled: Bool
            

imageResultEnabled #

Enables or disables capturing and processing of image data when a barcode is selected in AR mode.

Default value is false.

                @objc public var imageResultEnabled: Bool
            

barcodeThumbnailOnResult #

Enables or disables emitting barcode thumbnails with AR results.

Default value is false.

                @objc public var barcodeThumbnailOnResult: Bool
            

resultLimit #

Maximum number of barcode results allowed in a single AR scanning session.

Set to 0 for unlimited results.

Default value is 0.

                @objc public var resultLimit: Int
            

continueScanningOnLimit #

Defines whether scanning should continue when the result limit is reached (in non-interactive).

If false, scanning ends when the limit is reached.

Default value is false.

                @objc public var continueScanningOnLimit: Bool
            

emitResultsAtSessionEndOnly #

Controls when AR results are emitted to the delegate.

If true, results are emitted once at session end (or when the limit is reached).

If false, results are emitted continuously as they are selected.

Default value is false.

                @objc public var emitResultsAtSessionEndOnly: Bool
            

headerHeight #

Height of the header area drawn above the barcode in AR mode.

Default value is 19.0.

                @objc public var headerHeight: Float
            

headerShowMode #

Defines when the header text (label above barcodes) should be visible in AR mode.

Default value is .onSelected.

                @objc public var headerShowMode: BarkoderARHeaderShowMode
            

headerMaxTextHeight #

Maximum text height inside the AR header area.

Default value is 20.0.

                @objc public var headerMaxTextHeight: Float
            

headerMinTextHeight #

Minimum text height inside the AR header area.

Default value is 7.0.

                @objc public var headerMinTextHeight: Float
            

headerTextColorSelected #

Text color used for the header when the barcode is selected.

                @objc public var headerTextColorSelected: UIColor
            

headerTextColorNonSelected #

Text color used for the header when the barcode is not selected.

                @objc public var headerTextColorNonSelected: UIColor
            

headerHorizontalTextMargin #

Horizontal margin (left and right padding) inside the AR header around the text.

Default value is 5.0.

                @objc public var headerHorizontalTextMargin: Float
            

headerVerticalTextMargin #

Vertical margin (top and bottom padding) inside the AR header around the text.

Default value is 3.0.

                @objc public var headerVerticalTextMargin: Float
            

headerTextFormat #

Format string for the header text above barcodes.

Supports dynamic placeholders such as [barcode_type], [barcode_text], [gs1], etc.

Default value is "[barcode_text]".

                @objc public var headerTextFormat: String
            



BarkoderHelper #

scanImage #

Scan barcode from a bitmap image

Parameters:

imageThe UIImage you want to be scanned
bkdConfigThe configuration to be used for the scanning process
resultDelegateThe location where you will receive the scanned result
                @objc public static func scanImage(_ image: UIImage, bkdConfig: BarkoderConfig,resultDelegate: BarkoderResultDelegate)
            

applyConfigSettingsFromTemplate #

Apply config params from a pre-defined template

Parameters:

BarkoderConfig configconfig that will be configured
BarkoderConfigTemplate templatetemplate that will be applied on config
finishedThis will be executed when the function is finished
                @objc public static func applyConfigSettingsFromTemplate(_ config: BarkoderConfig,
template: BarkoderConfigTemplate, finished: @escaping (BarkoderConfig) -> Void)
            

applyConfigSettingsFromURL #

Retrieve config properties from the URL and apply them in the config that is sent as an input param

Parameters:

BarkoderConfig configthe config parameters that we are using for configuration
filePath urlurl to the JSON file
finishedcallback that will be executed when this function is finished
                @objc public static func applyConfigSettingsFromURL(_ config: BarkoderConfig, url: URL,
finished: @escaping (BarkoderConfig?, Error?) -> Void)
            

applyConfigSettingsFromFile #

Retrieve config properties from the URL and apply them in the config that is sent as an input param

Parameters:

configconfig that will be configured
urlfilePath to the JSON file
finishedcallback that will be executed when this function is finished
                @objc public static func applyConfigSettingsFromFile(_ config: BarkoderConfig, url: String,
finished: @escaping (BarkoderConfig?, Error?) -> Void)
            

applyConfigSettingsFromJson #

Retrieve config properties from a JSON and apply them in the config that is sent as an input param

Parameters:

configconfig that will be configured
jsonDataJSON
finishedcallback that will be executed when this function is finished
                @objc public static func applyConfigSettingsFromJson(_ config: BarkoderSDK.BarkoderConfig, jsonData: Data, finished: @escaping (BarkoderSDK.BarkoderConfig?, (Error)?) -> Void)
            

configToJSON #

Export config that is send as input param to JSON string

Parameter barkoderConfig: config that will be exported.

Returns: JSON string

                @objc public static func configToJSON(_ barkoderConfig: BarkoderConfig) -> String?
            

Visit our website at https://barkoder.com for detailed information on our products and services. It has resources about our Barcode Reader SDK for iOS applications.

For a quote on implementing our SDK, contact us. We provide detailed pricing based on your needs. We look forward to working with you.

Page Contents