RSDActiveStepViewController

open class RSDActiveStepViewController : RSDFullscreenImageStepViewController

RSDActiveStepViewController is a simple timer for displaying a longer activity where the user is doing an action while the countdown timer is running.

This view controller includes a default nib implementation that is included in this framework. It includes various UI elements that can indicate to the user how much time is remaining in a longer-running step. For example, this could be used during a walk step to indicate to the user how long they have been walking as well as how much longer they have to walk before the step is complete.

Seealso

RSDTaskViewController.vendDefaultViewController(for:)
  • An instruction label that is updated to show the same text that is spoken as a spoken instruction to the user.

    Seealso

    `speakInstruction(_:, at:, completion:)

    Declaration

    Swift

    @IBOutlet
    open var instructionLabel: UILabel?
  • The countdown dial is a graphical element used to display progress to the user.

    Declaration

    Swift

    @IBOutlet
    open var countdownDial: RSDProgressIndicator?
  • The unit label is a label that can be used to indicate the unit of the progress label. It is included as a separate label to allow that text to be easily defined with a different font, color, and/or position in the associated nib or storyboard.For example, in a walking step, a subclass may use the progress label to display the distance the user walked (calulated using GPS or pedometer sensor data) and would then assign this label to the feet or meters showing the unit of measurement.

    Note

    The default implementation does not use this label, but it is included so that subclasses may take advantage of it and still use the default nib included in this framework.

    Seealso

    progressLabel

    Declaration

    Swift

    @IBOutlet
    open var unitLabel: UILabel?
  • A label that is updated to show a countdown. For example, 5:35.

    Declaration

    Swift

    @IBOutlet
    open var countdownLabel: UILabel?
  • A label that is displayed to the user when the countdown is finished.

    Declaration

    Swift

    @IBOutlet
    open var doneLabel: UILabel?
  • Returns the allowed countdown units for the countdown label. Default is to show only seconds if the duration is less than 90 seconds.

    Declaration

    Swift

    open var allowedCountdownUnits: NSCalendar.Unit { get }
  • Formatter for the countdown label.

    Declaration

    Swift

    lazy open var countdownFormatter: DateComponentsFormatter { get set }
  • This class overrides didSet to update the countdownLabel to the new value formatted as a time interval in seconds. The countdownFormatter is used to format the string derived from this time interval.

    Declaration

    Swift

    open override var countdown: Int { get set }
  • Update the countdown labels

    Declaration

    Swift

    open func updateCountdownLabels()
  • This class overrides the speak instruction method and will set the instructionLabel to the same text that the voice synthesizer speaks.

    Declaration

    Swift

    open override func speakInstruction(_ instruction: String, at timeInterval: TimeInterval, completion: RSDVoiceBoxCompletionHandler?)
  • The start method is overridden to start the countdown dial animation.

    Declaration

    Swift

    open override func start()
  • The pause method is overridden to pause the countdown dial animation.

    Declaration

    Swift

    override open func pause()
  • The pause method is overridden to resume the countdown dial animation.

    Declaration

    Swift

    override open func resume()
  • Override the timer to check if finished.

    Declaration

    Swift

    override open func timerFired()
  • Stop any recorders that are attached to this step which would normally be stopped when the participant navigates away from the step.

    Declaration

    Swift

    open func stopAsyncActions()
  • Called when the timer has fired and should either transition to the next step or update the display.

    Declaration

    Swift

    open func timerFinished(_ duration: TimeInterval)
  • List of views that are hidden when transitioning to the finished state.

    Seealso

    timerFinished()

    Declaration

    Swift

    @IBOutlet
    open var activeViews: [UIView]?
  • Override viewDidLoad to set up initial values for the labels and progress indicators.

    Declaration

    Swift

    open override func viewDidLoad()
  • Declaration

    Swift

    open override func viewWillAppear(_ animated: Bool)
  • Declaration

    Swift

    open override func setupViews()
  • Declaration

    Swift

    override open func setColorStyle(for placement: RSDColorPlacement, background: RSDColorTile)
  • The default nib name to use when instantiating the view controller using init(step:).

    Declaration

    Swift

    open class var nibName: String { get }
  • The default bundle to use when instantiating the view controller using init(step:).

    Declaration

    Swift

    open class var bundle: Bundle { get }
  • Default initializer. This initializer will initialize using the nibName and bundle defined on this class.

    Declaration

    Swift

    public override init(step: RSDStep, parent: RSDPathComponent?)

    Parameters

    step

    The step to set for this view controller.

  • Initialize the class using the given nib and bundle.

    Note

    If this initializer is used with a nil nib, then it must assign the expected outlets.

    Declaration

    Swift

    public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?)

    Parameters

    nibNameOrNil

    The name of the nib or nil.

    nibBundleOrNil

    The name of the bundle or nil.

  • Required initializer. This is the initializer used by a UIStoryboard.

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)

    Parameters

    aDecoder

    The decoder used to initialize this view controller.