Skip to content

Instantly share code, notes, and snippets.

View aydin-emre's full-sized avatar

Emre AYDIN aydin-emre

View GitHub Profile
# Pods for HMSAnalyticsKit
pod 'HiAnalytics'
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
HiAnalytics.onEvent("TestEvent", setParams: ["Q1": "A1", "Q2": "A2"])
pod 'ScanKitFrameWork'
<key>NSCameraUsageDescription</key>
<string>App needs your consent to access the camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App needs your consent to access the album</string>
import ScanKitFrameWork
let options = HmsScanOptions(scanFormatType: 0, photo: false)
if let hmsDefaultScanViewController = HmsDefaultScanViewController(defaultScanWithFormatType: options) {
hmsDefaultScanViewController.defaultScanDelegate = self
self.view.addSubview(hmsDefaultScanViewController.view)
self.addChild(hmsDefaultScanViewController)
self.didMove(toParent: hmsDefaultScanViewController)
}
// DefaultView Delegate
extension ViewController: DefaultScanDelegate {
func defaultScanImagePickerDelegate(for image: UIImage!) {
let dic = HmsBitMap.bitMap(for: image, with: HmsScanOptions(scanFormatType: 0, photo: true))
parseResult(dic)
}
func defaultScanDelegate(forDicResult resultDic: [AnyHashable : Any]!) {
parseResult(resultDic)
func parseResult(_ dictionary: [AnyHashable : Any]?) {
if let dictionary = dictionary, let text = dictionary["text"] {
print("*** Text: \(text)")
if let formatValue = dictionary["formatValue"] {
print("*** CodeFormat: \(formatValue)")
}
if let sceneType = dictionary["sceneType"] {
print("*** ResultType: \(sceneType)")
}
} else {
pod 'AGConnectCore'
pod 'AGConnectAuth'