{"id":25932655,"url":"https://github.com/socketmobile/capturesingleentryswift-ios","last_synced_at":"2025-03-04T00:38:41.500Z","repository":{"id":43642943,"uuid":"118625855","full_name":"SocketMobile/capturesingleentryswift-ios","owner":"SocketMobile","description":"SingleEntry in Swift using the Capture SDK","archived":false,"fork":false,"pushed_at":"2024-12-09T20:55:35.000Z","size":4192,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-12-09T21:34:38.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SocketMobile.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-01-23T15:03:16.000Z","updated_at":"2024-12-09T20:55:39.000Z","dependencies_parsed_at":"2024-12-09T21:29:35.448Z","dependency_job_id":"17b2d313-b253-4f8e-93a5-2342fd147d6c","html_url":"https://github.com/SocketMobile/capturesingleentryswift-ios","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesingleentryswift-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesingleentryswift-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesingleentryswift-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesingleentryswift-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocketMobile","download_url":"https://codeload.github.com/SocketMobile/capturesingleentryswift-ios/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":[],"created_at":"2025-03-04T00:38:41.014Z","updated_at":"2025-03-04T00:38:41.472Z","avatar_url":"https://github.com/SocketMobile.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SingleEntrySwift for iOS\n\nSimple iOS app showing the use of our `iOS CaptureSDK` as a Swift Package Manager.\n\n## Prerequisites\n\nThe Socket Mobile `CaptureSDK` is required in order to compile this sample.\n\n## Documentation\n\nThe `CaptureSDK` documentation can be found [here](https://docs.socketmobile.com/capture/ios/en/latest/swift.html \"Capture SDK documentation\").\n\n## Installation\n\nClone the project and open `SingleEntrySwift.xcodeproj`\n\nIt is very important to make sure your application's `info.plist` file contains the following:\n\n- `LSApplicationQueriesSchemes (Queried URL Schemes)` with a new array item: `sktcompanion` (in lower case).\n\n- `UISupportedExternalAccessoryProtocols` the supported external accessory protocol array item `com.socketmobile.chs` (Adding the external accessory protocol string to your application will require your application to be whitelisted with Socket Mobile before submission to the App Store.). Make sure to contact Socket Mobile in order to whitelist your application.  You can submit your app to be whitelisted in the Socket Mobile Developer portal.\n\n- `CFBundleAllowMixedLocalizations` to `YES`\n\n- `NSCameraUsageDescription` string to a reason to use our camera scanning feature SocketCam\n\n- `NSBluetoothAlwaysUsageDescription` string to a reason to use Bluetooth connection\n\nThen you will have to generate your application credentials with the application bundle identifier of your choice from our Developers Portal and paste those credentials into the `SingleEntryViewController.swift` line 103 to 105 to be able to open our `CaptureSDK`. If you get an error `-19` when opening `CaptureSDK`, it means that your credentials are wrong and/or your application bundle identifier is not the same than your credentials.\n\nBuild and run the application on a device in order to test with a Socket Mobile device or to test our camera scanning SocketCam.\n\n## Screenshots\n\n### Main View\n\nThe main view shows the connection status, an edit box that receives the decoded data and a \"settings\" link to display the settings view. When a scanner is connected, its friendly name appears in the status.\n\n![Main View](./img/SingleEntryMain.png \"Main View\")\n\n## Description\n\nSingleEntrySwift displays a scanner connection status.\n\nWhen a scanner is connected, its friendly name is displayed.\n\nThe edit box receives the decoded data from the scanner.\n\n## CaptureHelper Implementation\n\nWe recommend you to use `CaptureHelper` as it helps you to write boilerplate code for many `CaptureSDK` operations.\n\nIn this simple example the `CaptureHelper` is \"attached\" to the main view controller.\n\nThis main view controller derives from the `CaptureHelperDevicePresenceDelegate`, `CaptureHelperDeviceDecodedDataDelegate`, `CaptureHelperErrorDelegate` and `CaptureHelperDevicePowerDelegate` protocols and implements their respective delegate methods.\n\n### CaptureHelper shared instance feature\n\nAs a showcase, this sample application shows the `CaptureHelper` shared instance.\n\nThe purpose of this feature is to share CaptureHelper across the view hierarchy without the need to pass between the views an explicit reference to CaptureHelper.\n\nWhen a view using `CaptureHelper` is active, it pushes its delegate using the `CaptureHelper` `pushDelegate` method which makes this view active to receive\nnotifications from `CaptureHelper`.\n\nThe first notification the view might receive could be `didNotifyArrivalForDevice`, when a Socket Mobile device is already connected to the host, even though other views may have already received this notification.\n\nOnce the view becomes inactive, then it should call the `CaptureHelper` `popDelegate` to remove itself from receiving notification.\n\nAt this point, the prior view, if it exists, that had pushed its delegate becomes the one receiving the notifications.  \n\n### Main view controller viewDidLoad\n\nThe viewDidLoad handler opens `CaptureHelper` just after pushing its own reference as the delegate requiring the MainViewController to derive from one the CaptureHelperDelegate protocol.\nThere is a bunch of protocols to choose from depending on what Capture notifications the application is interested.\n\n### CaptureHelper openWithAppInfo\n\nThis is the fist method to call in order to be able to use Capture.\n\nThe application information should be set accordingly to the information provided during the [application registration](http://www.socketmobile.com/developer/appkey-registration \"Application Registration\") in the Socket Mobile developer portal.\n\nThis method must be called only once in the entire application.\n\nThe completion handler confirms if Capture has been opened successfully. Bear in mind that the open is an asynchronous method.\n\n**NOTE**: It is not recommended to close Capture because this forces Capture to reinitialize the Socket Mobile device the next time the application opens Capture. Closing Capture does not save more power and if the application does not want to receive any events from Capture, it can just call `popDelegate` method as explained above.\n\n### didNotifyArrivalForDevice\n\nThis CaptureHelperDevicePresenceDelegate method is called when a scanner is\nsuccessfully detected by the host. The scanner can be SoftScan or any other\nSocket Mobile scanners supported by Capture.\n\n### didNotifyRemovalForDevice\n\nThis CaptureHelperDevicePresenceDelegate method is called when a scanner is no\nlonger available (disconnected).\n\n### didReceiveDecodedData\n\nThis CaptureHelperDeviceDecodedDataDelegate method is called when a barcode has\nbeen successfully decoded by the scanner.\n\n## CaptureHelper\n\n`CaptureHelper` is provided as source code. It provides a set of very basic features like enabling disabling barcode symbologies.\n\nIf a needed feature is not implemented by `CaptureHelper`, the recommendation is\nto create a `CaptureHelper` extension and copy paste a feature similar from\n`CaptureHelper` class to the extended one.\n\nAn example of this **CaptureHelper extension** is shown in the `CaptureHelperExtension.swift`\n\n## Host Acknowledgment\n\nFor some applications it might be required to check the decoded data before letting the user scan more barcodes.\nThis feature is shown with the code enclosed in #if HOST_ACKNOWLEDGMENT statement.\n\nTo activate this feature go to the project settings and in the \"Other Swift Flags\" rename this \"-DNO_HOST_ACKNOWLEDGMENT\" to this \"-DHOST_ACKNOWLEDGMENT\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketmobile%2Fcapturesingleentryswift-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketmobile%2Fcapturesingleentryswift-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketmobile%2Fcapturesingleentryswift-ios/lists"}