Protocols
The following protocols are available globally.
-
See moreRSDSurveyNavigationStep
evaluatesRSDSurveyRule
objects that are associated with each input field to determine if the step navigation should skip to another step.Declaration
Swift
public protocol RSDSurveyNavigationStep : RSDNavigationRule
-
See moreRSDSurveyInputField
extends theRSDInputField
protocol to also support an array ofRSDSurveyRule
objects. These rules are evaluated on theRSDAnswerResult
given for this input field and if they evaluate totrue
then they are used to return the next identifier.Declaration
Swift
public protocol RSDSurveyInputField : RSDInputField
-
Delegate for the data source.
See moreDeclaration
Swift
public protocol RSDFormStepDataSourceDelegate: class, NSObjectProtocol
-
RSDFormStepDataSource
: the internal model for a table view controller. It provides the UITableViewDataSource, manages and stores answers provided thru user input, and provides an RSDResult with those answers upon request.It also provides several convenience methods for saving or selecting answers, checking if all answers are valid, and retrieving specific model objects that may be needed by the ViewController.
The tableView data source is comprised of 3 objects:
RSDTableSection
: An object representing a section in the tableView. It has one or more RSDTableItemGroup objects.RSDTableItemGroup
: An object representing a specific question supplied byRSDStep
as an input field. Upon init(), the ItemGroup will create one or moreRSDTableItem
objects representing the answer options for theRSDInputField
. The ItemGroup is responsible for storing/computing the answers for itsRSDInputField
.RSDTableItem
: An object representing a specific answer option from the ItemGroup (RSDInputField), such as a Yes or No choice in a boolean question or a string or number that’s entered thru a text field. There will be one TableItem for each indexPath in the tableView.
Declaration
Swift
public protocol RSDFormStepDataSource : class
-
See moreRSDTaskControllerDelegate
is responsible for processing the results of the task, providing some input into how the controller behaves, and providing additional content as needed. It’s primary purpose is to handle processing the results of running the task.Declaration
Swift
public protocol RSDTaskControllerDelegate : class, NSObjectProtocol
-
RSDTaskController
handles default implementations for running a task.To start a task, create an instance of a view controller that conforms to this protocol and set either the
See moretopLevelTask
or thetopLevelTaskInfo
.Declaration
Swift
public protocol RSDTaskController : class, NSObjectProtocol
-
See moreRSDSchemaInfo
is a lightweight interface for schema information used to upload the results of a task. The schema info is intended to allow for reproducing a previously presented survey where the survey may have changed and requires revisioning to know what version of the survey task was run.Declaration
Swift
public protocol RSDSchemaInfo
-
See moreRSDEmbeddedIconVendor
is a convenience protocol for fetching an codable image using an optionalRSDImageWrapper
. This protocol implements an extension method to fetch the icon.Declaration
Swift
public protocol RSDEmbeddedIconVendor
-
The
See moreRSDImageWrapperDelegate
is a singleton delegate that can be used to customize the rules for fetching an image using theRSDImageWrapper
. If defined and attached to theRSDImageWrapper
using the static propertysharedDelegate
then the image wrapper will ask the delegate for the appropriate image.Declaration
Swift
public protocol RSDImageWrapperDelegate
-
See moreRSDPickerDataSource
includes information that can be used to build a picker UI element.Declaration
Swift
public protocol RSDPickerDataSource
-
A data source for selecting a date.
See moreDeclaration
Swift
public protocol RSDDatePickerDataSource : RSDPickerDataSource
-
A picker data source for selecting choices.
See moreDeclaration
Swift
public protocol RSDChoicePickerDataSource : RSDPickerDataSource
-
A picker data source for picking a number.
See moreDeclaration
Swift
public protocol RSDNumberPickerDataSource : RSDPickerDataSource
-
Undocumented
See moreDeclaration
Swift
public protocol RSDNumberFormatterProtocol
-
See moreRSDMultipleComponentOptions
is a data source protocol that can be used to set up a picker.Declaration
Swift
public protocol RSDMultipleComponentChoiceOptions : RSDChoicePickerDataSource
-
See moreRSDMultipleComponentOptions
is a data source protocol that can be used to set up a picker.Declaration
Swift
public protocol RSDMultipleComponentOptions : RSDMultipleComponentChoiceOptions
-
See moreRSDChoiceOptions
is a data source protocol that can be used to set up a picker or list of choices.Declaration
Swift
public protocol RSDChoiceOptions : RSDChoicePickerDataSource
-
See moreRSDTextFieldOptions
defines the options for a text field.Declaration
Swift
public protocol RSDTextFieldOptions
-
Undocumented
See moreDeclaration
Swift
public protocol RSDTextValidator
-
Undocumented
See moreDeclaration
Swift
public protocol RSDRegExMatchValidator : RSDTextValidator
-
Undocumented
See moreDeclaration
Swift
public protocol RSDCodableRegExMatchValidator : RSDRegExMatchValidator
-
RSDSectionStepTransformer
is a lightweight protocol for vending the steps in a section. This object is used to allow accessing anRSDSectionStep
for use in multiple tasks or multiple times within a task.For example, for a task where the user is going to run for 12 minutes, the researchers may wish to record the user’s heart rate both before and after the run. The heart rate can be defined in a seperate file or model object and the transformer is used as a placeholder that can fetch and replace itself with a section of steps that are used to capture the user’s heartrate.
See moreDeclaration
Swift
public protocol RSDSectionStepTransformer
-
See moreRSDSectionStepResourceTransformer
is an implementation of aRSDSectionStepTransformer
that uses aRSDResourceTransformer
to support transforming the section from one resource for inclusion in another task defined using a different resource.Declaration
Swift
public protocol RSDSectionStepResourceTransformer : RSDSectionStepTransformer, RSDResourceTransformer
-
RSDStringLiteralOptionSet
extendsOptionSet
to allow mapping any OptionSet that uses aBinaryInteger
as itsRawValue
to a set of string keys.Seealso
RSDActiveUICommand
for example usage.Declaration
Swift
public protocol RSDStringLiteralOptionSet : OptionSet, Codable
-
See moreRSDTaskTransformer
The task transformer is a lightweight protocol for vending a task. This can be used by anRSDTaskInfoStep
to fetch a task or depending upon the design of the application, it could be used to fetch a task that is loaded from a table or collection view before presenting the task.Declaration
Swift
public protocol RSDTaskTransformer
-
See moreRSDTaskResourceTransformer
is an implementation of aRSDTaskTransformer
that uses aRSDResourceTransformer
to support transforming a resource either using an online URL or an embedded file.Declaration
Swift
public protocol RSDTaskResourceTransformer : RSDTaskTransformer, RSDResourceTransformer
-
See moreRSDPermissionType
is a generic configuration object with information about a given permission. The permission type can be used by the app to handle gracefully requesting authorization from the user for access to sensors and hardware required by the app.Declaration
Swift
public protocol RSDPermissionType
-
RSDAsyncActionConfiguration
defines general configuration for an asynchronous background action that should be run in the background. Depending upon the parameters and how the action is set up, this could be something that is run continuously or else is paused or reset based on a timeout interval.The configuration is intended to be a serializable object and does not call services, record data, or anything else. It does include a step identifier that can be used to let the
See moreRSDTaskController
know when to trigger the async action.Declaration
Swift
public protocol RSDAsyncActionConfiguration
-
See moreRSDAsyncActionControllerVendor
is an extension of the configuration protocol for configurations that know how to vend a new controller.Declaration
Swift
public protocol RSDAsyncActionControllerVendor : RSDAsyncActionConfiguration
-
See moreRSDRecorderConfiguration
is used to configure a recorder. For example, recording accelerometer data or video.Declaration
Swift
public protocol RSDRecorderConfiguration : RSDAsyncActionConfiguration
-
RSDJSONRecorderConfigureation
is used to configure a recorder to record JSON samples.Seealso
RSDSampleRecorder
Declaration
Swift
public protocol RSDJSONRecorderConfiguration : RSDRecorderConfiguration
-
RSDRequestConfiguration
is used to start an asynchronous service such as a url request or fetching from core data.Note
This configuration type is stubbed out for future work. This is not currently implemented in eitherRSDTaskController
orRSDTaskViewController
. (syoung 11/15/2017)Declaration
Swift
public protocol RSDRequestConfiguration : RSDAsyncActionConfiguration
-
See moreRSDAsyncActionControllerDelegate
is the delegate protocol forRSDAsyncActionController
.Declaration
Swift
public protocol RSDAsyncActionControllerDelegate : class
-
A controller for an async action configuration.
See moreDeclaration
Swift
public protocol RSDAsyncActionController : class, NSObjectProtocol
-
See moreRSDEmbeddedResourceUIAction
is a convenience protocol for returning an image using an encodable strings for the name and bundle identifier.Declaration
Swift
public protocol RSDEmbeddedResourceUIAction: RSDUIAction, RSDDecodableBundleInfo
-
Undocumented
Declaration
Swift
public protocol RSDArrayExtension
-
See moreRSDTaskInfoStep
is a reference interface for information about the task. This includes information that can be displayed in a table or collection view before starting the task as well as information that is displayed while the task is being fetched in the case where the task is not fetched using an embedded resource or via a hardcoded task.Declaration
Swift
public protocol RSDTaskInfoStep : RSDStep
-
See moreRSDStepController
handles default implementations for running a step in a task.Declaration
Swift
public protocol RSDStepController : class, NSObjectProtocol
-
RSDRange
defines range constraints that are appropriate for a given data type.Declaration
Swift
public protocol RSDRange
-
See moreRSDRangeWithFormatter
is an optional extension of the range that can be used to extend the range to include a formatter appropriate to the UI. For example, this could be used to describe a number range that displays currency.Declaration
Swift
public protocol RSDRangeWithFormatter : RSDRange
-
See moreRSDNumberRange
extends the properties of anRSDInputField
for adecimal
orinteger
data type.Declaration
Swift
public protocol RSDNumberRange : RSDRange
-
Define the navigation rule as a protocol to allow for protocol-oriented extension (multiple inheritance). Currently defined usage is to allow the
See moreRSDConditionalStepNavigator
to check if a step has a navigation rule and apply as necessary.Declaration
Swift
public protocol RSDNavigationRule : RSDStep
-
A conditional rule is appended to the navigable task to check a secondary source for whether or not the step should be displayed.
Note
ResearchSuite
does not currently implement any conditional rule objects. The conditional rule is included here for future implementation of data tracking across runs of a task. (syoung 10/03/2017)Declaration
Swift
public protocol RSDConditionalRule
-
Implementation of a step navigator that will apply conditions and navigation based on the steps, navigation rules, and conditional rules associated with this navigator.
See moreDeclaration
Swift
public protocol RSDConditionalStepNavigator : RSDStepNavigator, RSDStepValidator
-
See moreRSDUSMeasurementPickerDataSource
is a generic protocol for converting US Customary units (multiple component) to metric units.Declaration
Swift
public protocol RSDUSMeasurementPickerDataSource : RSDMultipleComponentChoiceOptions
-
The
See moreRSDUIAction
protocol can be used to customize the title and image displayed for a given action of the UI.Declaration
Swift
public protocol RSDUIAction : Codable
-
See moreRSDWebViewUIAction
implements an extension of the base protocol where the action includes a pointer to a url that can display in a webview. The url can either be fully qualified or optionally point to an embedded resource. The resource bundle is assumed to be the main bundle if thebundleIdentifier
property isnil
.Declaration
Swift
public protocol RSDWebViewUIAction : RSDUIAction, RSDResourceTransformer
-
RSDSkipToUIAction
implements an extension of the base protocol where the action includes an identifier for a step to skip to if this action is called. This is used by theRSDConditionalStepNavigator
to navigate based on anil
result.Seealso
RSDSurveyNavigationStep
Declaration
Swift
public protocol RSDSkipToUIAction : RSDUIAction
-
See moreRSDUIActionHandler
implements the custom actions of the step.Declaration
Swift
public protocol RSDUIActionHandler
-
RSDResult
is the base implementation for a result associated with a task, step, or asynchronous action.When running a task, there will be a result of some variety used to mark each step in the task. This is the base protocol. All the
See moreRSDResult
objects are required to conform to theCodable
protocol to allow the app to store and upload results in a standardized way.Declaration
Swift
public protocol RSDResult : Codable
-
See moreRSDTaskResult
is a result associated with a task. This object includes a step history, task run UUID, schema identifier, and asynchronous results.Declaration
Swift
public protocol RSDTaskResult : RSDResult, RSDAnswerResultFinder
-
See moreRSDCollectionResult
is used include multiple results associated with a single step or async action that may have more that one result.Declaration
Swift
public protocol RSDCollectionResult : RSDResult, RSDAnswerResultFinder
-
RSDAnswerResultFinder
is a convenience protocol used to retrieve an answer result. It is used in survey navigation to find the result for a given input field.Seealso
RSDSurveyNavigationStep
Declaration
Swift
public protocol RSDAnswerResultFinder
-
See moreRSDAnswerResult
is a result that can be described using a single value.Declaration
Swift
public protocol RSDAnswerResult : RSDResult, RSDAnswerResultFinder
-
See moreRSDTask
is the interface for running a task. It includes information about how to calculate progress, validation, and the order of display for the steps.Declaration
Swift
public protocol RSDTask : RSDUIActionHandler
-
See moreRSDTaskDataSource
is a data source that can be used by the factory to get info that should be included with a task result or used to display subgroups of a task.Declaration
Swift
public protocol RSDTaskDataSource
-
See moreJSONDecoder
andPropertyListDecoder
do not share a common protocol so extend them to be able to create the appropriate decoder and set the userInfo keys as needed.Declaration
Swift
public protocol RSDFactoryDecoder
-
See moreJSONEncoder
andPropertyListEncoder
do not share a common protocol so extend them to be able to create the appropriate decoder and set the userInfo keys as needed.Declaration
Swift
public protocol RSDFactoryEncoder
-
See moreRSDTaskGroup
defines a subgrouping of tasks. This is used in UI presentations where the researchers wish to tie a group of activities and surveys together but allow the user to perform them non-sequentially or with a break between the activities.Declaration
Swift
public protocol RSDTaskGroup
-
Light-weight protocol for handling generic equality without requiring a class or struct to implement all of the
See moreNSObjectProtocol
.Declaration
Swift
public protocol RSDObjectProtocol
-
The
See moreRSDSampleRecord
defines the properties that are included with all JSON logging samples. By defining a protocol, the logger can include markers for step transitions and the records are defined asCodable
but the actualCodingKey
implementation can be changed to match the requirements of the research study.Declaration
Swift
public protocol RSDSampleRecord : Codable
-
See moreRSDSurveyRule
defines an evaluation rule and returns a step identifier if appropriate.Declaration
Swift
public protocol RSDSurveyRule
-
See moreRSDComparableSurveyRule
is a survey rule that matches an expected result to the answer and vends a skip identifier if the match is evaluated totrue
.Declaration
Swift
public protocol RSDComparableSurveyRule : RSDSurveyRule, RSDComparable
-
See moreRSDComparable
can be used to compare a stored result to a matching value.Declaration
Swift
public protocol RSDComparable
-
See moreRSDDecimalComparable
can be used to compare a stored result to a matching value where the values are decimals.Declaration
Swift
public protocol RSDDecimalComparable : RSDComparable
-
RSDInputField
is used to describe a form input and includes the data type and a possible hint to how the UI should be displayed. The ResearchSuite framework usesRSDFormUIStep
to represent questions to ask the user. Each question must have at least one associated input field. An input field is validated when its owning step is validated.Seealso
RSDFormUIStep
Declaration
Swift
public protocol RSDInputField
-
See moreRSDChoice
is used to describe a choice item for use with a multiple choice or multiple component input field.Declaration
Swift
public protocol RSDChoice
-
See moreRSDChoiceInputField
extends the properties ofRSDInputField
with information required to create a multiple or single choice question.Declaration
Swift
public protocol RSDChoiceInputField : RSDInputField, RSDChoiceOptions
-
RSDMultipleComponentInputField
extends the properties ofRSDInputField
with information required to create a multiple component input field.Declaration
Swift
public protocol RSDMultipleComponentInputField : RSDInputField, RSDMultipleComponentOptions
-
RSDStep
is the base protocol for the steps that can compose a task for presentation using a controller appropriate to the device and application. EachRSDStep
object represents one logical piece of data entry, information, or activity in a larger task.Implementations included in this SDK include:
RSDGenericStep
is used byRSDFactory
to create a step that does not include a recognized subtype.RSDSectionStep
is used to define a logical subgroup of steps.RSDUIStep
is used to define a display step.RSDTaskInfoStep
is used to combine tasks into a single flow. For example, if the researcher wishes to ask for survey responses before an activity.
A step can be a question, an active test, or a simple instruction. An
See moreRSDStep
subclass is usually paired with anRSDStepController
that controls the actions of the step.Declaration
Swift
public protocol RSDStep
-
See moreRSDGenericStep
is a step with key/value pairs decoded from a dictionary. This is the default step returned byRSDFactory
for an unrecoginized type.Declaration
Swift
public protocol RSDGenericStep : RSDStep
-
See moreRSDSectionStep
is used to define a logical subgrouping of steps such as a section in a longer survey or an active step that includes an instruction step, countdown step, and activity step.Declaration
Swift
public protocol RSDSectionStep: RSDStep, RSDTask, RSDConditionalStepNavigator
-
See moreRSDUIStep
is used to define a singledisplay unit
. Depending upon the available real-estate, more than one ui step may be displayed at a time. For example, on an iPad, you may choose to group a set of questions using aRSDSectionStep
.Declaration
Swift
public protocol RSDUIStep: RSDStep, RSDUIActionHandler
-
RSDMutableStep
is a step that supports copying information from a dictionary into this step. Because this step can be mutated, it must be implemented as a class.Seealso
RSDUIStepObject
for an example implementation.Declaration
Swift
public protocol RSDMutableStep: class, RSDStep
-
See moreRSDActiveUIStep
extends theRSDUIStep
to include a duration and commands. This is used for the case where anRSDUIStep
has an action such asstart walking
orstop walking
; the step may also implement theRSDActiveUIStep
protocol to allow for spoken instruction.Declaration
Swift
public protocol RSDActiveUIStep: RSDUIStep
-
See moreRSDResourceTransformer
is a protocol for getting either embedded resources or online resources.Declaration
Swift
public protocol RSDResourceTransformer: RSDDecodableBundleInfo
-
See moreRSDStepNavigator
is the model object used by theRSDTaskController
to determine the order of presentation of the steps in a task.Declaration
Swift
public protocol RSDStepNavigator
-
See moreRSDJSONNumber
implements converting a Swift number to an Objective-CNSNumber
.Declaration
Swift
public protocol RSDJSONNumber : Codable
-
Undocumented
Declaration
Swift
public protocol RSDDictionaryExtension
-
See moreRSDUIThemeElement
is used to tell the application UI view controllers how to style a given step.Declaration
Swift
public protocol RSDUIThemeElement
-
See moreRSDDecodableBundleInfo
is a convenience protocol for getting a bundle from a bundle identifier.Declaration
Swift
public protocol RSDDecodableBundleInfo
-
See moreRSDViewThemeElement
tells the UI where to find the view controller to use when instantiating theRSDStepController
.Declaration
Swift
public protocol RSDViewThemeElement : RSDUIThemeElement
-
See moreRSDColorThemeElement
tells the UI what the background color and foreground color are for a given view as well as whether or not the foreground elements should uselight style
.Declaration
Swift
public protocol RSDColorThemeElement : RSDUIThemeElement
-
See moreRSDImageThemeElement
extends the UI step to include an image.Declaration
Swift
public protocol RSDImageThemeElement : RSDUIThemeElement
-
See moreRSDFetchableImageThemeElement
defines an image that can be fetched asynchronously.Declaration
Swift
public protocol RSDFetchableImageThemeElement : RSDImageThemeElement
-
See moreRSDAnimatedImageThemeElement
defines a series of images that can be animated.Declaration
Swift
public protocol RSDAnimatedImageThemeElement : RSDImageThemeElement
-
See moreRSDStepValidator
is a convenience protocol for validating the steps in a list as unique.Declaration
Swift
public protocol RSDStepValidator
-
See moreRSDDateCoder
is used to handle specifying date encoding/decoding. If the calendar components supported by this formatter only include a subset of all the components then only those components should be displayed in the UI.Declaration
Swift
public protocol RSDDateCoder : Codable
-
Protocol for converting an object to a dictionary representation. This is included for reverse-compatiblility to older implementations that are not Swift 4
See moreCodable
and instead use a dictionary representation.Declaration
Swift
public protocol RSDDictionaryRepresentable
-
Protocol for converting objects to JSON serializable objects
See moreDeclaration
Swift
public protocol RSDJSONValue