AboundScanControllerDelegate

@objc
public protocol AboundScanControllerDelegate

This protocol defines a set of optional methods that you can use to control the 3D mapping interface.

  • Informs the delegate that the user has requested to save the scan.

    Implement this method and call saveCallback with data you want to store against the scan. To cancel saving, pass nil.

    For example, to open a dialog to ask user for a description of their scan, you could use the following.

    func scanController(_ scanController: AboundScanController,
                        shouldSaveScanWithInfo info: [AboundScanController.InfoKey: Any],
                        saveCallback: @escaping ([String: Any]?) -> Void) {
        let dialog = UIAlertController(title: "Enter description", message: nil,
                                       preferredStyle: .alert)
        dialog.addTextField()
        dialog.addAction(UIAlertAction(title: "Cancel", style: .cancel) { _ in
            saveCallback(nil)
        })
        dialog.addAction(UIAlertAction(title: "OK", style: .default) { _ in
            saveCallback(["description": dialog.textFields!.first!.text!])
        })
        scanController.present(dialog, animated: true)
    }
    

    Declaration

    Swift

    @objc
    func scanController(_ scanController: AboundScanController, shouldSaveScanWithInfo info: [AboundScanController.InfoKey: Any],
                        saveCallback: @escaping ([String: Any]?) -> Void)

    Parameters

    scanController

    The controller object managing the scanning user interface.

    info

    Information about the scan.

    saveCallback

    Call this function with the tags to store against the scan. Tags must be encoded to JSON using JSONSerialization. If you want to cancel saving, then pass nil.

  • Informs the delegate that the scan has finished saving the scan.

    Declaration

    Swift

    @objc
    func scanController(_ scanController: AboundScanController, didFinishScanningWithInfo info: [AboundScanController.InfoKey : Any])

    Parameters

    scanController

    The controller object managing the scanning user interface.

    info

    Information about the scan.

  • Informs the delegate that the user cancelled the scanning operation, e.g. by tapping the Back button.

    The default implementation dismisses the view controller. scanController.dismiss(animated: true)

    Declaration

    Swift

    @objc
    func scanControllerDidCancel(_ scanController: AboundScanController)

    Parameters

    scanController

    The controller object managing the scanning user interface.

  • Informs the delegate that scanning failed for some reason.

    The error object contains information about the type and source of the AboundError.

    • For the type of error, see the three digit code as described in AboundError.Code.
    • For human-readable messages, see localizedDescription, failureReason, and recoverySuggestion.
    • For more information about the source of the error, see error.errorUserInfo, e.g. underlying error for network errors, or a path for file not found errors.

    Declaration

    Swift

    @objc
    func scanController(_ scanController: AboundScanController, didFailWithError error: AboundError)

    Parameters

    scanController

    The controller object managing the scanning user interface.

    error

    The error that occurred.