{"id":25932649,"url":"https://github.com/socketmobile/swift-package-capturesdk","last_synced_at":"2026-04-02T19:07:42.768Z","repository":{"id":56797045,"uuid":"465254513","full_name":"SocketMobile/swift-package-capturesdk","owner":"SocketMobile","description":"CaptureSDK is the easiest solution for adding barcode scanning and RFID/NFC reading capability to an iOS application","archived":false,"fork":false,"pushed_at":"2025-02-21T15:42:33.000Z","size":37278,"stargazers_count":10,"open_issues_count":6,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-21T16:36:44.560Z","etag":null,"topics":["barcode","bluetooth","bluetooth-le","bluetooth-low-energy","camera-scanner","camera-scanning","capture","capturesdk","ios","qrcode","scanner","swift"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SocketMobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-02T10:16:32.000Z","updated_at":"2025-02-21T15:42:36.000Z","dependencies_parsed_at":"2024-12-21T12:19:38.015Z","dependency_job_id":"303248b9-93df-4cdc-8133-3fa476d86c28","html_url":"https://github.com/SocketMobile/swift-package-capturesdk","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":"0.19999999999999996","last_synced_commit":"278a9d28a82c7691f9b45375d5a9e5bc63e90991"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fswift-package-capturesdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fswift-package-capturesdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fswift-package-capturesdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fswift-package-capturesdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocketMobile","download_url":"https://codeload.github.com/SocketMobile/swift-package-capturesdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763763,"owners_count":20016161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","bluetooth","bluetooth-le","bluetooth-low-energy","camera-scanner","camera-scanning","capture","capturesdk","ios","qrcode","scanner","swift"],"created_at":"2025-03-04T00:38:40.553Z","updated_at":"2026-04-02T19:07:42.752Z","avatar_url":"https://github.com/SocketMobile.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CaptureSDK Version 2.0.73 - Swift Package Manager\n\nSocket Mobile is a leading innovator of data capture and delivery solutions for enhanced productivity.\n\nCaptureSDK is the easiest solution for adding barcode scanning and RFID/NFC reading capability to an iOS application.\n\nThe Socket Mobile barcode scanner and contactless reader/writer are an ergonomic, fast and accurate solution to a variety of data entry scenarios.\n\nThis SDK is very easy to integrate to an application without requirement to follow a specific design architecture.\n\nWithin 10 minutes the barcode scanning or RFID/NFC reading capability can be integrated into an application.\n\nThe CaptureSDK offers a built-in barcode scanner called SocketCam, allowing to test and integrate the SDK even before getting a Socket Mobile scanner, using the exact same API, which makes the transition from using SocketCam to a Socket scanner totally frictionless.\n\nMore documentation can be found [here in our CaptureSDK Documentation](https://docs.socketmobile.dev/capture/ios/en/latest/).\n\n## From 8th of October 2025 - Noticeable change from version 2.0\n\n**There are 2 choices to connect and use our Bluetooth LE readers:**\n\n**- Install our [Socket Mobile Companion app](https://apps.apple.com/app/socket-mobile-companion/id1175638950) which takes care of the discovery and the selection of the reader to connect to.**\n\n**- Write some code to fit the Bluetooth discovery flow to your application's design by creating an UI that starts and shows discovered devices and select them to be paired to your application.**\n\n[See our Getting Started section in our documentation](https://docs.socketmobile.dev/capture/ios/en/latest/gettingStarted.html)\n\n## Devices compatibility and CaptureSDK versions\n\n|       Devices                                          |          \u003c 2.0         |          2.0           |\n| :----------------------------------------------------: | :--------------------: | :--------------------: |\n|   **SocketCam C820, C860**                             |          ✅            |           ✅           |\n|   **S720/D720/S820**                                   |          ✅            |           ✅           |\n|   **D600, S550, and all other barcode scanners**       |          ✅            |           ✅           |\n|   **S370**                                             |          ✅            |           ✅           |\n|   **M930**                                             |          ✅            |           ✅           |\n|   **S320**                                             |          ✅            |           ✅           |\n|   **S721** (new Bluetooth LE barcode scanner)          |          ❌            |           ✅           |\n\n## Table of Contents\n\n* [Breaking changes V2.0](#breaking-changes)\n* [Quick install notes](#quick-install-notes)\n* [CaptureSDK usage](#capturesdk-usage)\n* [Sample code](#sample-code)\n* [SocketCam C820 \u0026 C860](#socketcam-c820-and-c860)\n* [Configure and connect a Socket Mobile device](#configure-and-connect-a-socket-mobile-device)\n* [Device Notifications (Battery Level)](#device-notifications-battery-level)\n* [Closing CaptureSDK](#closing-capturesdk)\n\n## Breaking changes\n\nWe have made a step forward and changed a few things to stay up to date with  requirements. The SDK still works as you expect.\n\n* CaptureSDK is built with Xcode 26\n* The minimum target is now iOS 15.0\n* The Bluetooth discovery flow is a bit different. The transition of our products from Bluetooth Classic to Bluetooth Low Energy forces to change the Developers and Users Experience slightly. You can use our CaptureSDK to connect devices either through our [Socket Mobile Companion app](https://apps.apple.com/app/socket-mobile-companion/id1175638950) which takes care of the discovery and the selection of the reader to connect to, or, you can write your own code, using the new CaptureSDK APIs, to make a UI for the discovery that fits your design and application's flow.\n\n## Quick install notes\n\nCaptureSDK is using [Swift Package Manager](https://www.swift.org/package-manager/).\n\nFirst, you need to install Xcode.\n\nTo include the SDK in your Xcode project you have to add a `Package Dependency` in the project's settings section and in the tab \"Package Dependencies\".\n\nAdd the url of this repository: [https://github.com/SocketMobile/swift-package-capturesdk.git](https://github.com/SocketMobile/swift-package-capturesdk.git)\n\n![Add the Package to the project](./docs/add-to-your-project.png)\n\nOnce you have added the package, you should see `CaptureSDK` added to your Package Dependencies in Xcode's Project Navigator as follow:\n\n![Added Package to the project](./docs/added-to-your-project.png)\n\n**VERY IMPORTANT**: Supported external accessory protocols array in the application settings.\nIn order to be able to use the Socket Mobile barcode scanners, the scanners external accessory protocol string needs to be added in the application project info in the **supported external accessory protocols array**.\n\nThe protocol string is `com.socketmobile.chs`.\n\nIf the application does use a Socket Mobile barcode scanner it will need to be MFi whitelisted before submitting the application in the App Store. Socket Mobile will handle the whitelist (MFi) application process for you, when you submit your app for MFi in your Socket Mobile developer account. This has to be done once for the first version supporting the barcode scanner.\n\nYou also need to add the following key to your `Info.plist`: **CFBundleAllowMixedLocalizations** (*Localized resources can be mixed*) to **`YES`**. That allows or SDK to display localized strings.\n\nAn AppKey is required in order to use CaptureSDK.\n\nThe AppKey can be generated by logging in Socket Mobile developer portal and registering your application.\n\nThis registration needs the Socket Mobile developer ID, the application Bundle ID (which is case sensitive).\n\nNow you're ready to add `import CaptureSDK` in your main controller, and make it derive from one of the `CaptureHelperDelegate` that your application needs.\n\nGo to the `CaptureHelperDelegate` source and copy paste the delegates you want to override, at minimum the onDecodedData delegate in order to be able to receive the barcode decoded data in your application.\n\n## CaptureSDK usage\n\n`CaptureSDK` is described in greater details in the [documentation](https://docs.socketmobile.dev/capture/ios/en/latest/ \"CaptureSDK Documentation\").\n\nThe recommended way of using `CaptureSDK` is by using `CaptureHelper`. `CaptureHelper` is now included into the framework and not as a separate file: [CaptureHelper](https://docs.socketmobile.dev/capture/ios/en/latest/captureHelper.html)\n\n### 1. Getting a `CaptureHelper` instance\n\n`CaptureHelper` can be instantiated in one of your application controllers using its `CaptureHelper.sharedInstance` static member.\n\n### 2. `CaptureHelper` delegates stack\n\nThe chosen controller must implement one of the `CaptureHelper[xxxxx]Delegate` protocols in order to receive the various `CaptureSDK` asynchronous events.\n\nThe reference of the controller deriving from at least one of the `CaptureHelper[xxxxx]Delegate` can be set by using the `CaptureHelper pushDelegate` method.\n\n`CaptureHelper` maintains a delegates stack. The delegate on top of the stack is the one that receives the notification from `CaptureSDK`. So if the application has multiple views requiring the scanning feature, it can push a reference of a new view controller to the `CaptureHelper` delegates stack, and remove that reference when the view is no longer active.\n\n### 3. Opening `CaptureHelper`\n\nIn order to start `CaptureSDK`, the API uses the `openWithAppInfo:withCompletionHandler` method with the application information.\n\nThis open method **can be called only once**, in the main view controller by example, and the `CaptureHelper.sharedInstance` can be used at various place in the application code as singleton reference without the need to pass it through various controllers.\n\nThe application information is retrieved from the Socket Mobile developer portal, by registering the application with its application ID, the developer ID. The application key is then generated and all three initialize the AppInfo required to open `CaptureSDK`.\n\nThe application ID is composed by the application bundle ID prefixed by the platform on which the application is designed to run.\n\nHere is an example of such application ID: `\"ios:com.socketmobile.SingleEntry\"`. The application ID is **case sensitive**.\n\nOnce `CaptureSDK` is open, then the device arrival notification can occurs as soon as a scanner is connected to the iOS device.\n\nThe decoded data coming from the scanner can be retrieved by overriding the `onDecodedData` delegate.\n\n**IMPORTANT**:\nIf a property is not accessible through the available `CaptureHelper` methods, it is very easy to add new ones, by creating a `CaptureHelper` **extension** class and copy and paste a similar get/set method and change the property settings inside the new method.\n\nCreating a `CaptureHelper` extension allows to avoid an overwrite of a modified version of `CaptureHelper` when updating to a more recent `CaptureSDK` CocoaPods.\n\n### 4. Sample code\n\nTry out our sample [our Single Entry app on Github SocketMobile](https://github.com/SocketMobile/capturesingleentryswift-ios)\n\n## SocketCam C820 and C860\n\nWe have included `SocketCam C820` \u0026 `SocketCam C860` into the SDK, formerly known as SoftScan.\n\nFor SocketCam C860 is an enhanced version of SocketCam C820, you also need to add the following key to your `Info.plist`: **LSApplicationQueriesSchemes** (*Queried URL Schemes*) with a new item: **sktcompanion** (in lower case).\n\nIn order to use it you have to install [Socket Mobile Companion](https://apps.apple.com/app/socket-mobile-companion/id1175638950) on your device.\n\nYou can find more details about SocketCam C860 [on our website](https://www.socketmobile.com/readers-accessories/data-readers/camera-based-socketcam).\n\n`SocketCam` feature refers to the capability of using the phone's camera in order to scan a barcode. The main purpose of integrating this feature in `CaptureSDK` is to provide a consistent interface to barcode readers.\n\nWhether it is a Socket Mobile scanner, or simply the phone's camera, the application relies on the same interface, same API, which makes the transition from using SocketCam to a physical Socket scanner totally frictionless.\n\nThe application using the `SocketCam` feature needs to do 2 things differently, which Socket Mobile scanners don't require.\n\nThe first thing is to provide a trigger logic that starts the `SocketCam` scanning operation. The trigger is a `CaptureSDK` property `kSktCapturePropIdTriggerDevice` that exists since the first version of `CaptureSDK`.\n\nA third property `kSktCapturePropIdSocketCamStatus` allows to enable or disable the `SocketCam` feature. This is a `CaptureSDK` property that is persistent across the life cycle of the application using it.\n\nIf the `SocketCam` feature is enabled, `CaptureSDK` will send a device arrival notification to the application referencing a `SocketCam` device the application can control.\n\nOnce the application triggers a read, the decoded data arrives the same way with the same information than as any other Socket Mobile devices supported by `CaptureSDK`.\n\nFor more information please check the [documentation](https://docs.socketmobile.dev/capture/ios/en/latest/ \"CaptureSDK Documentation\").\n\nWith the new version of CaptureSDK available, you will be able to present SocketCam as you wish in a custom view, a popover and still in full screen. Now you decide where and when triggering and removing SocketCam view controller in your application's flow. And this is your responssability to handle the presentation and the dismissal of the view controller.\nHowever, there's a minimal size of 250px x 250px to observe in order to display all SocketCam's UI elements.\n\nBEFORE\n\n![BEFORE](./docs/socketcam-fullscreen.jpeg)\n\nAFTER\n\n![AFTER](./docs/socketcam-custom.jpeg)\n\n### Sample code\n\n```swift\nlet scanner = CaptureHelperDevice()\n\nscanner.setTrigger(.start, withCompletionHandler: { result, propertyObject in\n\n    DispatchQueue.main.async {\n        if let anObject = propertyObject?.object, let dic = anObject as? [String: Any], let objectType = dic[\"SKTObjectType\"] as? String, objectType == \"SKTSocketCamViewControllerType\", let socketCamViewController = dic[\"SKTSocketCamViewController\"] as? UIViewController {\n\n            ////\n            // Present the socketCamViewController in a popover or a subview or in full screen\n            ////\n        }\n    }\n\n})\n\nextension YourViewController: CaptureHelperDeviceDecodedDataDelegate {\n\n    // This delegate is called each time a decoded data is read from a scanner or SocketCam\n    func didReceiveDecodedData(_ decodedData: SKTCaptureDecodedData?, fromDevice device: CaptureHelperDevice, withResult result:SKTResult) {\n        print(\"---\u003e\u003e\u003e didReceiveDecodedData for device: \\(device.deviceInfo.deviceType)\")\n        if result == .E_NOERROR {\n            let str = decodedData!.stringFromDecodedData()\n            print(\"Decoded Data \\(String(describing: str))\")\n            DispatchQueue.main.async {\n\n                ////\n                // When receiving your decoded data you can dismiss, hide, remove the SocketCam custom view controller\n                ////\n\n            }\n        }\n    }\n\n}\n```\n\nDepending on how you want to display SocketCam in your application, it may require to show or hide the close button of the SocektCam view controller. Ideally, you can execute this at the device arrival of a SocketCam device, whether it is C820 or C860. In order to do so, add a specific configuration as follow:\n\n```swift\nlet prop = SKTCaptureProperty()\nprop.id = SKTCapturePropertyID.configuration\nprop.type = .string\nprop.stringValue = \"SocketCamCloseButton=enabled\" /// to show the close button\n// OR\nprop.stringValue = \"SocketCamCloseButton=disabled\" /// to hide the close button\nself.captureHelper.setProperty(prop) { result, complete in\n\n}\n```\n\nIf you add the SocketCam view controller as a subview in another view controller (`myView.addsubview(self.socketCamViewController.view)`), then you need to remove the SocketCam view controller's view when you finish using it (`self.socketCamViewController.view.removeFromSuperview()`) otherwise it won't be displayed the next time you trigger SocketCam. So it's good to keep a reference on the SocketCam view controller when it is given by the CaptureHelper method `setTrigger`\n\n## Configure and connect a Socket Mobile device\n\n`CaptureSDK` is designed for using all of the Socket Mobile devices on the iOS platforms.\n\nAs the application developer, `CaptureSDK` will give you full programmatic access to a connected Socket Mobile data capture device to customize the data source (barcode symbology or RFID Tag), data support and manage device feedback\nmessages and functions.\n\nThe API documentation for `CaptureSDK` can be found [here](https://docs.socketmobile.dev/capture/ios/en/latest/ \"Capture Documentation\")\n\nThe Socket Mobile devices are shipped by default in **MFi mode** which is compatible with the `CaptureSDK`.\n\nThe device can be configured to the **Application mode** by using the [Socket\nMobile Companion app](https://itunes.apple.com/us/app/socket-mobile-companion/id1175638950?mt=8 \"Socket Mobile Companion\").\n\nYou can also refer to the [documentation](https://docs.socketmobile.dev/capture/ios/en/latest/ConfigureInAppMode.html \"Configure and connect scanner\") for instructions without using Companion.\n\n**Bluetooth LE Devices**\n\nFor our Blueetooth LE devices (D600, S550, S370, S320 and S721), use the following:\n\n**- Install our [Socket Mobile Companion app](https://apps.apple.com/app/socket-mobile-companion/id1175638950) which takes care of the discovery and the selection of the reader to connect to.**\n\n**- Write some code to fit the Bluetooth discovery flow to your application's design by creating an UI that starts and shows discovered devices and select them to be paired to your application.**\n\n## Themes selection\n\nThe Themes Selection allows to choose LEDs sequences that are played on S550 or S370 devices. Please check the [documentation](https://docs.socketmobile.dev/capture/ios/en/latest/topicsThemesSelection.html \"CaptureSDK Documentation - Themes Selection\").\n\n## Device Notifications (Battery Level)\n\nThe Device Notifications can be configured in order to receive a notification each time one or more of those events occur:\n\n* Battery Level change\n* Power State change\n* Buttons State change\n\nBy default the device notifications are turned off. The recommended usage is to first check if a particular notification is turned off or on. Depending on this reading, then the application can set a specific notification to be received if it is not already set. That setting stays persistent in the Socket Mobile device across scanner shutdown. It is not recommended to set systematically a notification in the device without checking first if that setting is already correct.\n\nFor the Battery Level and Power State, it could take a long time before the state changes, so usually the initial value is read using the corresponding `CaptureHelper` Get method.\n\nLast, some devices don't support some of the notifications. If that's the case, an error `ESKT_NOTSUPPORTED (-15)` is returned when trying to set a notification that is not supported.\n\nFor more information please check the [documentation](https://docs.socketmobile.dev/capture/ios/en/latest/ \"CaptureSDK Documentation\").\n\n## Closing `CaptureSDK`\n\n**It is not recommended to close `CaptureSDK` because the scanner will go through reinitialization the next time `CaptureSDK` is open which causes a delay before being able to use the scanner.**\n\nClosing `CaptureSDK` does not affect power consumption, since the scanner stays connected to the iOS host for Bluetooth Classic scanners.\n\nFor Bluetooth LE scanners, the CaptureSDK releases the connection to devices or it remains connected to the iOS host if added with Companion.\n\nIt is also worth noting that when the Socket Mobile device is connected the power consumption is really minimal, compare to establishing a connection.\n\nIf the motive of closing `CaptureSDK` is to not receive any decoded data from the device then the application delegate can simply be removed and the application will no longer receive any event from the scanner until it sets its delegate back again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketmobile%2Fswift-package-capturesdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketmobile%2Fswift-package-capturesdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketmobile%2Fswift-package-capturesdk/lists"}