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
(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).
Create an instance of
Capture.FeatureFlagsand customize it based on your app’s needs.Pass a created
Capture.FeatureFlagsinstance to the appropriate document-type-specficCapture.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
Enable the location feature flag in
Capture.FeatureFlagsas explained on Capture Feature FlagsEnsure that
NSLocationWhenInUseUsageDescriptionentitlement (displayed as Privacy - Location when in use usage description) to your application’sInfo.plistas 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())
}
}