API reference for barKoder's iOS Barcode Scanner SDK
BarkoderView1 #
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()
stopCamera #
Stop the camera preview session and decoding if active.
@objc func stopCamera()
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()
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
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
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 Normal(HD), or HIGH(Full HD)
Default value is BarkoderView.BarkoderResolution.normal
@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
BarkoderHelper #
scanImage #
Scan barcode from a bitmap image
Parameters:
image
: The UIImage you want to be scanned.
bkdConfig
: The configuration to be used for the scanning process.
resultDelegate
: The 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 config
: that will be configured.
BarkoderConfigTemplate template
: that will be applied on config.
finished
: that will be executed when this 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 config
: the config parameters that we are using for configuration.
filePath url
: url to the JSON file.
finished
: callback 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:
config
: that will be configured.
url
: filePath to the JSON file.
finished
: callback 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:
config
: that will be configured.
jsonData
: JSON.
finished
: callback 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)
barkoderConfig #
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.