LiG Scanner SDK for iOS

Overview

The LiG Scanner SDK for iOS enables iOS app to find LigTag device as entrance to AR world. Checkout Essentials For LiG Scanner SDK if you missed.

Limitation

Get Started

Use git to clone this repo. You can build and scan LigTag right away.

If you have any troubles, please checkout Essentials For LiG Scanner SDK for more information. Product Key is used to authenticate with bundle id.

Import SPM LiG Scanner SDK package

We support Swift Package Manager package. You can take master branch. This is a binary framework.

Xcode Build Setting (Xcode version < 15)

  • OTHER_LDFLAGS( Other Linker Flags ): -ObjC -l”c++”
  • ENABLE_BITCODE: NO

Permission

  • Camera: Add Privacy - Camera Usage Description entry in Info.plist

Initialization

Before initialize() is called, implement a delegate of LiGScannerDelegate to handle poor internet or camera resource. Checkout ScannerStatus for more information. Once initialization is done, you will received .deviceIsSupported and .authenticationOk in func scannerStatus(_ status: ScannerStatus) callback.

// Swift
import LiGScanner

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        let productKey = "your_product_key_here"
        LiGScanner.sharedInstance().initialize(productKey)
        return true
    }
}

Start Scanning

  1. Start Scanner: Call the start() method to begin scanning. The SDK will open the back camera for capturing.
  2. Handle Results: Implement delegate of LiGScannerDelegate to receive scanning results and additional status updates.
  3. Stop Scanner: Call the stop() method to stop scanning and release the camera resources.
// Swift
import LiGScanner

class ViewController: UIViewController, LiGScannerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        LiGScanner.sharedInstance().delegate = self
    }

    // Implement the callback interface to handle results
    func scannerStatus(_ status: ScannerStatus) {
        if status == .authenticationOk {
            // When product key is valid
            LiGScanner.sharedInstance().start()
        }
        // Handle other status
    }

    func scannerResult(_ ids: [LightID]) {
        // Handle the scanner result
        if (ids.count > 0) {
           let lightId = ids[0]
           ...
           if lightId.isReady {
               LiGScanner.sharedInstance().stop()
               ...
           }
        }
    }
}

Contact Us

For more information or to request a demo, please contact our sales team at rd@lig.com.tw.