Skip to content

Implementation

You can display and use the augmented reality view using ARViewController class and it's handler ARHandlerProtocol.

ARViewController

The ARViewController provides an infrastructure for your application to manage BearScanner. You can create instances of ARViewController or its subclasses and use these objects to provide the specific behavior and visual appearance you need.

  • recognitionTimeout - The time after that scanner will be paused. The default value of this property is 8 seconds;
  • scanlineColor - Customize scan line color. The default value of this property is purple color;
  • handler - The object conforms to ARHandlerProtocol to control Bear scanner features;
  • delegate - Use your own ARDelegate implementation. Delegate provides a mechanism for your application to take action on events that occur in the ARViewController.

To get more information about ARDelegate or ARHandlerProtocol take a look on special ARDelegate article or special ARHandlerProtocol article.

Note: You can create multiple instances of ARViewController or its subclasses, but you can 't show them simultaneously. And keep in mind that each instance of ARViewController or its subclass uses the same view for rendering. Be careful with the view states.

ARHandlerProtocol

The ARHandlerProtocol provides a mechanism for your application to handle features of ARViewController(Objc).

  • Take screenshot of camera view, ignoring any overlapping UI elements;
  • Get the current state of the scanner;
  • Start/stop scanning;
  • Clean augmented reality view and destroy all loaded data;
  • Enable/disable and check current state of flash;

The ARHandlerProtocol should not be used before ARViewController view will be loaded. It will not trigger crash or an unexpected behavior, but triggered action will not have any effect. You will receive warning message in debug output.