Baraba

public class Baraba : NSObject

The main object that you use to add auto-scrolling to a scroll view.

  • Returns a boolean value indicating whether a given configuration is supported by the device.

    Declaration

    Swift

    public static func isConfigurationSupported(_ configuration: BarabaConfiguration) -> Bool
  • The scroll view that will be auto-scrolled when user is looking at the device.

    Declaration

    Swift

    public weak var scrollView: UIScrollView? { get set }
  • The delegate for the Baraba object.

    Declaration

    Swift

    public weak var delegate: BarabaDelegate?
  • The duration of pause after user finishes dragging the scroll view. Default value is 2.0 seconds.

    After this amount of duration, auto-scrolling resumes.

    Declaration

    Swift

    public var pauseDuration: TimeInterval { get set }
  • The preferred speed for auto-scrolling the scroll view, represented in points per second.

    The actual speed chosen is the nearest multiple of 60. For example, if you set this value to 140, the actual speed will be 120 as it is closer to 120 than 180. Check the actualScrollSpeed property.

    Default value is 180. The minimum is 60.

    Declaration

    Swift

    public var preferredScrollSpeed: Int { get set }
  • The actual scroll speed, represented in points per second.

    If you want to change the scroll speed, set the value to preferredScrollSpeed. It will be rounded to the nearest multiple of 60, which is the actual scroll speed.

    Default value is 180.

    Declaration

    Swift

    public var actualScrollSpeed: Int { get }
  • A Boolean value that indicates whether this Baraba object is active and tracking user’s face.

    This is a read-only property. If you want to make Baraba active, call resume() on the receiver.

    Declaration

    Swift

    public private(set) var isActive: Bool
  • A Boolean value that indicates whether the scroll view is being auto-scrolled. Read-only.

    Declaration

    Swift

    public var isScrolling: Bool { get }
  • Starts the tracking of user’s face for auto-scrolling.

    If the object fails to resume, func baraba(_ baraba: Baraba, didFailWithError error: Error) will be called on the delegate.

    Declaration

    Swift

    public func resume()
  • Pauses the tracking of user’s face.

    Call this method when you no longer need to track user’s face. For example, inside func viewWillDisappear(_ animated:) of a view controller.

    Declaration

    Swift

    public func pause()
  • Creates a new Baraba object with the specified configuration.

    Before initializing, you can check if the device supports the configuration by looking at isSupported property of a configuration object.

    Using an unsupported configuration will invoke func baraba(_ baraba: Baraba, didFailWithError error: Error) call to the delegate.

    Declaration

    Swift

    public init(configuration: BarabaConfiguration)

    Parameters

    configuration

    A configuration object that specifies which feature to use to track user’s face.