RSDStepNavigator
public protocol RSDStepNavigator
RSDStepNavigator
is used by the RSDTaskController
to determine the order of presentation of the steps
in a task. The navigator should include navigation that is based on the input model and the results rather
that depending upon the available real estate.
-
Returns the step associated with a given identifier.
Declaration
Swift
func step(with identifier: String) -> RSDStep?
Parameters
identifier
The identifier for the step.
Return Value
The step with this identifier or nil if not found.
-
Should the task exit early from the entire task?
Declaration
Swift
func shouldExit(after step: RSDStep?, with result: RSDTaskResult) -> Bool
Parameters
step
The current step.
result
The current result set for this task.
Return Value
true
if the task view controller should exit. -
Is there a step after the current step with the given result.
Note
the result may not include a result for the current step.
Declaration
Swift
func hasStep(after step: RSDStep?, with result: RSDTaskResult) -> Bool
Parameters
step
The current step.
result
The current result set for this task.
Return Value
true
if the task view controller should show a next button. -
Given the current task result, is there a step after the current step?
This method is checked when first displaying a step to determine if the UI should display this as the last step. By default, the UI defined in ResearchUI will change the text on the continue button from
Next
toDone
, unless customized.Note
the task result may or may not include a result for the given step.
Declaration
Swift
func hasStep(before step: RSDStep, with result: RSDTaskResult) -> Bool
Parameters
step
The current step.
result
The current result set for this task.
Return Value
true
if the task view controller should show a next button. -
Given the current task result, is there a step before the current step?
This method is checked when first displaying a step to determine if the UI should display this as the first step. By default, the UI defined in ResearchUI will hide the
Back
button if there is no step before the given step.Note
the task result may or may not include a result for the given step.
Declaration
Swift
func step(after step: RSDStep?, with result: inout RSDTaskResult) -> (step: RSDStep?, direction: RSDStepDirection)
Parameters
step
The current step.
result
The current result set for this task.
Return Value
true
if the task view controller should show a back button. -
Return the step to go to before the given step.
Declaration
Swift
func step(before step: RSDStep, with result: inout RSDTaskResult) -> RSDStep?
Parameters
step
The current step.
result
The current result set for this task.
Return Value
The previous step or nil if the task does not support backward navigation or this is the first step.
-
Return the progress through the task for a given step with the current result.
Declaration
Swift
func progress(for step: RSDStep, with result: RSDTaskResult?) -> (current: Int, total: Int, isEstimated: Bool)?
Parameters
step
The current step.
result
The current result set for this task.
Return Value
- current: The current progress. This indicates progress within the task.
- total: The total number of steps.
- isEstimated: Whether or not the progress is an estimate (if the task has variable navigation).