Flags on iOS

Capture provides a Capture.FeatureFlags configuration class to toggle the Capture features listed above. Once the Capture.FeatureFlags instance has been created and adjusted to satisfy the app’s needs, it is passed to Capture.RuntimeSettings (together with the Branding) to construct a Capture.RuntimeSettings for a specific document type (receipt or invoice).

Steps

  1. (Optional) Follow steps 1 - 3 of the Branding Implementation page if you wish to provide custom branding. You can skip this step to use default branding (as in the example below).

  2. Create an instance of Capture.FeatureFlags and customize it based on your app’s needs.

  3. Pass a created Capture.FeatureFlags instance to the appropriate document-type-specfic Capture.RuntimeSettings.

Example

// 2. Create an instance
let featureFlags: Capture.FeatureFlags = .default
featureFlags.attachLocationData = true // An example of modified feature flag

// 3. Pass a created Capture.FeatureFlags object to the Capture.RuntimeSettings
let receiptRuntimeSettings = Capture.RuntimeSettings.receipt(featureFlags: featureFlags)

// Pass the created Capture.RuntimeSettings to CaptureNavigationController
let capture = CaptureNavigationController(settings: receiptRuntimeSettings)

// ...

Capturing Location Metadata

  1. Enable the location feature flag in Capture.FeatureFlags as explained on Capture Feature Flags

  2. Ensure that NSLocationWhenInUseUsageDescription entitlement (displayed as Privacy - Location when in use usage description) to your application’s Info.plist as explained in the Adding the Required Entitlements section of the Get Started page.

If the user allows to collect the location where the image is taken, the location will become part of the image metadata.

You can also access the location metadata in CLLocation format, using getLocation() function, implemented in Sensibill SDK’s Data extension:

Example

func captureNavigationController(_ controller: CaptureNavigationController, didFinishCapture result: CaptureResult) {

    ...

    // Get image location metadata
    for image in result.images {
        print(image.getLocation())
    }
}