Protocols
The following protocols are available globally.
-
See moreRSDSurveyNavigationStepevaluatesRSDSurveyRuleobjects 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 moreRSDSurveyInputFieldextends theRSDInputFieldprotocol to also support an array ofRSDSurveyRuleobjects. These rules are evaluated on theRSDAnswerResultgiven for this input field and if they evaluate totruethen 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 byRSDStepas an input field. Upon init(), the ItemGroup will create one or moreRSDTableItemobjects 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 moreRSDTaskControllerDelegateis 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 -
RSDTaskControllerhandles 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 moretopLevelTaskor thetopLevelTaskInfo.Declaration
Swift
public protocol RSDTaskController : class, NSObjectProtocol
-
See moreRSDSchemaInfois 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 moreRSDEmbeddedIconVendoris 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 moreRSDImageWrapperDelegateis a singleton delegate that can be used to customize the rules for fetching an image using theRSDImageWrapper. If defined and attached to theRSDImageWrapperusing the static propertysharedDelegatethen the image wrapper will ask the delegate for the appropriate image.Declaration
Swift
public protocol RSDImageWrapperDelegate
-
See moreRSDPickerDataSourceincludes 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 moreRSDMultipleComponentOptionsis a data source protocol that can be used to set up a picker.Declaration
Swift
public protocol RSDMultipleComponentChoiceOptions : RSDChoicePickerDataSource -
See moreRSDMultipleComponentOptionsis a data source protocol that can be used to set up a picker.Declaration
Swift
public protocol RSDMultipleComponentOptions : RSDMultipleComponentChoiceOptions -
See moreRSDChoiceOptionsis a data source protocol that can be used to set up a picker or list of choices.Declaration
Swift
public protocol RSDChoiceOptions : RSDChoicePickerDataSource
-
See moreRSDTextFieldOptionsdefines 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
-
RSDSectionStepTransformeris a lightweight protocol for vending the steps in a section. This object is used to allow accessing anRSDSectionStepfor 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 moreRSDSectionStepResourceTransformeris an implementation of aRSDSectionStepTransformerthat uses aRSDResourceTransformerto support transforming the section from one resource for inclusion in another task defined using a different resource.Declaration
Swift
public protocol RSDSectionStepResourceTransformer : RSDSectionStepTransformer, RSDResourceTransformer
-
RSDStringLiteralOptionSetextendsOptionSetto allow mapping any OptionSet that uses aBinaryIntegeras itsRawValueto a set of string keys.See moreSeealso
RSDActiveUICommandfor example usage.Declaration
Swift
public protocol RSDStringLiteralOptionSet : OptionSet, Codable
-
See moreRSDTaskTransformerThe task transformer is a lightweight protocol for vending a task. This can be used by anRSDTaskInfoStepto 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 moreRSDTaskResourceTransformeris an implementation of aRSDTaskTransformerthat uses aRSDResourceTransformerto support transforming a resource either using an online URL or an embedded file.Declaration
Swift
public protocol RSDTaskResourceTransformer : RSDTaskTransformer, RSDResourceTransformer
-
See moreRSDPermissionTypeis 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 -
RSDAsyncActionConfigurationdefines 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 moreRSDTaskControllerknow when to trigger the async action.Declaration
Swift
public protocol RSDAsyncActionConfiguration -
See moreRSDAsyncActionControllerVendoris an extension of the configuration protocol for configurations that know how to vend a new controller.Declaration
Swift
public protocol RSDAsyncActionControllerVendor : RSDAsyncActionConfiguration -
See moreRSDRecorderConfigurationis used to configure a recorder. For example, recording accelerometer data or video.Declaration
Swift
public protocol RSDRecorderConfiguration : RSDAsyncActionConfiguration -
RSDJSONRecorderConfigureationis used to configure a recorder to record JSON samples.See moreSeealso
RSDSampleRecorderDeclaration
Swift
public protocol RSDJSONRecorderConfiguration : RSDRecorderConfiguration -
RSDRequestConfigurationis used to start an asynchronous service such as a url request or fetching from core data.See moreNote
This configuration type is stubbed out for future work. This is not currently implemented in eitherRSDTaskControllerorRSDTaskViewController. (syoung 11/15/2017)Declaration
Swift
public protocol RSDRequestConfiguration : RSDAsyncActionConfiguration
-
See moreRSDAsyncActionControllerDelegateis 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 moreRSDEmbeddedResourceUIActionis 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 moreRSDTaskInfoStepis 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 moreRSDStepControllerhandles default implementations for running a step in a task.Declaration
Swift
public protocol RSDStepController : class, NSObjectProtocol
-
RSDRangedefines range constraints that are appropriate for a given data type.Declaration
Swift
public protocol RSDRange -
See moreRSDRangeWithFormatteris 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 moreRSDNumberRangeextends the properties of anRSDInputFieldfor adecimalorintegerdata 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 moreRSDConditionalStepNavigatorto 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.
See moreNote
ResearchSuitedoes 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 moreRSDUSMeasurementPickerDataSourceis a generic protocol for converting US Customary units (multiple component) to metric units.Declaration
Swift
public protocol RSDUSMeasurementPickerDataSource : RSDMultipleComponentChoiceOptions
-
The
See moreRSDUIActionprotocol can be used to customize the title and image displayed for a given action of the UI.Declaration
Swift
public protocol RSDUIAction : Codable -
See moreRSDWebViewUIActionimplements 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 thebundleIdentifierproperty isnil.Declaration
Swift
public protocol RSDWebViewUIAction : RSDUIAction, RSDResourceTransformer -
RSDSkipToUIActionimplements 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 theRSDConditionalStepNavigatorto navigate based on anilresult.See moreSeealso
RSDSurveyNavigationStepDeclaration
Swift
public protocol RSDSkipToUIAction : RSDUIAction -
See moreRSDUIActionHandlerimplements the custom actions of the step.Declaration
Swift
public protocol RSDUIActionHandler
-
RSDResultis 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 moreRSDResultobjects are required to conform to theCodableprotocol to allow the app to store and upload results in a standardized way.Declaration
Swift
public protocol RSDResult : Codable -
See moreRSDTaskResultis 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 moreRSDCollectionResultis 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 -
RSDAnswerResultFinderis a convenience protocol used to retrieve an answer result. It is used in survey navigation to find the result for a given input field.See moreSeealso
RSDSurveyNavigationStepDeclaration
Swift
public protocol RSDAnswerResultFinder -
See moreRSDAnswerResultis a result that can be described using a single value.Declaration
Swift
public protocol RSDAnswerResult : RSDResult, RSDAnswerResultFinder
-
See moreRSDTaskis 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 moreRSDTaskDataSourceis 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 moreJSONDecoderandPropertyListDecoderdo 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 moreJSONEncoderandPropertyListEncoderdo 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 moreRSDTaskGroupdefines 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 moreRSDSampleRecorddefines 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 asCodablebut the actualCodingKeyimplementation can be changed to match the requirements of the research study.Declaration
Swift
public protocol RSDSampleRecord : Codable
-
See moreRSDSurveyRuledefines an evaluation rule and returns a step identifier if appropriate.Declaration
Swift
public protocol RSDSurveyRule -
See moreRSDComparableSurveyRuleis 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 moreRSDComparablecan be used to compare a stored result to a matching value.Declaration
Swift
public protocol RSDComparable -
See moreRSDDecimalComparablecan be used to compare a stored result to a matching value where the values are decimals.Declaration
Swift
public protocol RSDDecimalComparable : RSDComparable
-
RSDInputFieldis 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 usesRSDFormUIStepto 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.See moreSeealso
RSDFormUIStepDeclaration
Swift
public protocol RSDInputField -
See moreRSDChoiceis used to describe a choice item for use with a multiple choice or multiple component input field.Declaration
Swift
public protocol RSDChoice -
See moreRSDChoiceInputFieldextends the properties ofRSDInputFieldwith information required to create a multiple or single choice question.Declaration
Swift
public protocol RSDChoiceInputField : RSDInputField, RSDChoiceOptions -
RSDMultipleComponentInputFieldextends the properties ofRSDInputFieldwith information required to create a multiple component input field.Declaration
Swift
public protocol RSDMultipleComponentInputField : RSDInputField, RSDMultipleComponentOptions
-
RSDStepis the base protocol for the steps that can compose a task for presentation using a controller appropriate to the device and application. EachRSDStepobject represents one logical piece of data entry, information, or activity in a larger task.Implementations included in this SDK include:
RSDGenericStepis used byRSDFactoryto create a step that does not include a recognized subtype.RSDSectionStepis used to define a logical subgroup of steps.RSDUIStepis used to define a display step.RSDTaskInfoStepis 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 moreRSDStepsubclass is usually paired with anRSDStepControllerthat controls the actions of the step.Declaration
Swift
public protocol RSDStep -
See moreRSDGenericStepis a step with key/value pairs decoded from a dictionary. This is the default step returned byRSDFactoryfor an unrecoginized type.Declaration
Swift
public protocol RSDGenericStep : RSDStep -
See moreRSDSectionStepis 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 moreRSDUIStepis 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 -
RSDMutableStepis 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.See moreSeealso
RSDUIStepObjectfor an example implementation.Declaration
Swift
public protocol RSDMutableStep: class, RSDStep -
See moreRSDActiveUIStepextends theRSDUIStepto include a duration and commands. This is used for the case where anRSDUIStephas an action such asstart walking
orstop walking
; the step may also implement theRSDActiveUIStepprotocol to allow for spoken instruction.Declaration
Swift
public protocol RSDActiveUIStep: RSDUIStep
-
See moreRSDResourceTransformeris a protocol for getting either embedded resources or online resources.Declaration
Swift
public protocol RSDResourceTransformer: RSDDecodableBundleInfo
-
See moreRSDStepNavigatoris the model object used by theRSDTaskControllerto determine the order of presentation of the steps in a task.Declaration
Swift
public protocol RSDStepNavigator
-
See moreRSDJSONNumberimplements converting a Swift number to an Objective-CNSNumber.Declaration
Swift
public protocol RSDJSONNumber : Codable
-
Undocumented
Declaration
Swift
public protocol RSDDictionaryExtension
-
See moreRSDUIThemeElementis used to tell the application UI view controllers how to style a given step.Declaration
Swift
public protocol RSDUIThemeElement -
See moreRSDDecodableBundleInfois a convenience protocol for getting a bundle from a bundle identifier.Declaration
Swift
public protocol RSDDecodableBundleInfo -
See moreRSDViewThemeElementtells the UI where to find the view controller to use when instantiating theRSDStepController.Declaration
Swift
public protocol RSDViewThemeElement : RSDUIThemeElement -
See moreRSDColorThemeElementtells 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 moreRSDImageThemeElementextends the UI step to include an image.Declaration
Swift
public protocol RSDImageThemeElement : RSDUIThemeElement -
See moreRSDFetchableImageThemeElementdefines an image that can be fetched asynchronously.Declaration
Swift
public protocol RSDFetchableImageThemeElement : RSDImageThemeElement -
See moreRSDAnimatedImageThemeElementdefines a series of images that can be animated.Declaration
Swift
public protocol RSDAnimatedImageThemeElement : RSDImageThemeElement
-
See moreRSDStepValidatoris a convenience protocol for validating the steps in a list as unique.Declaration
Swift
public protocol RSDStepValidator
-
See moreRSDDateCoderis 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 moreCodableand instead use a dictionary representation.Declaration
Swift
public protocol RSDDictionaryRepresentable -
Protocol for converting objects to JSON serializable objects
See moreDeclaration
Swift
public protocol RSDJSONValue
View on GitHub
Protocols Reference