Protocols

The following protocols are available globally.

  • Delegate for the data source.

    See more

    Declaration

    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:

    1. RSDTableSection: An object representing a section in the tableView. It has one or more RSDTableItemGroup objects.

    2. RSDTableItemGroup: An object representing a specific question supplied by RSDStep as an input field. Upon init(), the ItemGroup will create one or more RSDTableItem objects representing the answer options for the RSDInputField. The ItemGroup is responsible for storing/computing the answers for its RSDInputField.

    3. 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.

    See more

    Declaration

    Swift

    public protocol RSDFormStepDataSource : class
  • RSDTaskControllerDelegate 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.

    See more

    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 topLevelTask or the topLevelTaskInfo.

    See more

    Declaration

    Swift

    public protocol RSDTaskController : class, NSObjectProtocol
  • RSDSchemaInfo 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.

    See more

    Declaration

    Swift

    public protocol RSDSchemaInfo
  • RSDEmbeddedIconVendor is a convenience protocol for fetching an codable image using an optional RSDImageWrapper. This protocol implements an extension method to fetch the icon.

    See more

    Declaration

    Swift

    public protocol RSDEmbeddedIconVendor
  • The RSDImageWrapperDelegate is a singleton delegate that can be used to customize the rules for fetching an image using the RSDImageWrapper. If defined and attached to the RSDImageWrapper using the static property sharedDelegate then the image wrapper will ask the delegate for the appropriate image.

    See more

    Declaration

    Swift

    public protocol RSDImageWrapperDelegate
  • RSDStringLiteralOptionSet extends OptionSet to allow mapping any OptionSet that uses a BinaryInteger as its RawValue to a set of string keys.

    Seealso

    RSDActiveUICommand for example usage.
    See more

    Declaration

    Swift

    public protocol RSDStringLiteralOptionSet : OptionSet, Codable
  • RSDPermissionType 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.

    See more

    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 RSDTaskController know when to trigger the async action.

    See more

    Declaration

    Swift

    public protocol RSDAsyncActionConfiguration
  • RSDAsyncActionControllerVendor is an extension of the configuration protocol for configurations that know how to vend a new controller.

    See more

    Declaration

    Swift

    public protocol RSDAsyncActionControllerVendor : RSDAsyncActionConfiguration
  • RSDRecorderConfiguration is used to configure a recorder. For example, recording accelerometer data or video.

    See more

    Declaration

    Swift

    public protocol RSDRecorderConfiguration : RSDAsyncActionConfiguration
  • RSDJSONRecorderConfigureation is used to configure a recorder to record JSON samples.

    See more

    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 either RSDTaskController or RSDTaskViewController. (syoung 11/15/2017)
    See more

    Declaration

    Swift

    public protocol RSDRequestConfiguration : RSDAsyncActionConfiguration
  • RSDTaskInfoStep 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.

    See more

    Declaration

    Swift

    public protocol RSDTaskInfoStep : RSDStep
  • RSDStepController handles default implementations for running a step in a task.

    See more

    Declaration

    Swift

    public protocol RSDStepController : class, NSObjectProtocol
  • RSDDateRange defines the range of values appropriate for a date data type.

    See more

    Declaration

    Swift

    public protocol RSDDateRange : RSDRange
  • RSDRange defines range constraints that are appropriate for a given data type.

    Declaration

    Swift

    public protocol RSDRange
  • RSDRangeWithFormatter 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.

    See more

    Declaration

    Swift

    public protocol RSDRangeWithFormatter : RSDRange
  • RSDNumberRange extends the properties of an RSDInputField for a decimal or integer data type.

    See more

    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 RSDConditionalStepNavigator to check if a step has a navigation rule and apply as necessary.

    See more

    Declaration

    Swift

    public protocol RSDNavigationRule : RSDStep
  • A navigation skip rule applies to this step to allow the step to be skipped.

    See more

    Declaration

    Swift

    public protocol RSDNavigationSkipRule : RSDStep
  • A navigation back rule applies to this step to block backward navigation.

    See more

    Declaration

    Swift

    public protocol RSDNavigationBackRule : 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)
    See more

    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 more

    Declaration

    Swift

    public protocol RSDConditionalStepNavigator : RSDStepNavigator, RSDStepValidator
  • The RSDUIAction protocol can be used to customize the title and image displayed for a given action of the UI.

    See more

    Declaration

    Swift

    public protocol RSDUIAction : Codable
  • RSDWebViewUIAction 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 the bundleIdentifier property is nil.

    See more

    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 the RSDConditionalStepNavigator to navigate based on a nil result.

    See more

    Declaration

    Swift

    public protocol RSDSkipToUIAction : RSDUIAction
  • RSDUIActionHandler implements the custom actions of the step.

    See more

    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 RSDResult objects are required to conform to the Codable protocol to allow the app to store and upload results in a standardized way.

    See more

    Declaration

    Swift

    public protocol RSDResult : Codable
  • RSDTaskResult is a result associated with a task. This object includes a step history, task run UUID, schema identifier, and asynchronous results.

    See more

    Declaration

    Swift

    public protocol RSDTaskResult : RSDResult, RSDAnswerResultFinder
  • RSDCollectionResult is used include multiple results associated with a single step or async action that may have more that one result.

    See more

    Declaration

    Swift

    public protocol RSDCollectionResult : RSDResult, RSDAnswerResultFinder
  • RSDFileResult is a result that holds a pointer to a file url.

    See more

    Declaration

    Swift

    public protocol RSDFileResult : RSDResult
  • RSDErrorResult is a result that holds information about an error.

    See more

    Declaration

    Swift

    public protocol RSDErrorResult : RSDResult
  • 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.

    See more

    Declaration

    Swift

    public protocol RSDAnswerResultFinder
  • RSDAnswerResult is a result that can be described using a single value.

    See more

    Declaration

    Swift

    public protocol RSDAnswerResult : RSDResult, RSDAnswerResultFinder
  • RSDTaskDataSource 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.

    See more

    Declaration

    Swift

    public protocol RSDTaskDataSource
  • JSONDecoder and PropertyListDecoder do not share a common protocol so extend them to be able to create the appropriate decoder and set the userInfo keys as needed.

    See more

    Declaration

    Swift

    public protocol RSDFactoryDecoder
  • JSONEncoder and PropertyListEncoder do not share a common protocol so extend them to be able to create the appropriate decoder and set the userInfo keys as needed.

    See more

    Declaration

    Swift

    public protocol RSDFactoryEncoder
  • RSDTaskGroup 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.

    See more

    Declaration

    Swift

    public protocol RSDTaskGroup
  • Light-weight protocol for handling generic equality without requiring a class or struct to implement all of the NSObjectProtocol.

    See more

    Declaration

    Swift

    public protocol RSDObjectProtocol
  • The RSDSampleRecord 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 as Codable but the actual CodingKey implementation can be changed to match the requirements of the research study.

    See more

    Declaration

    Swift

    public protocol RSDSampleRecord : Codable
  • RSDSurveyRule defines an evaluation rule and returns a step identifier if appropriate.

    See more

    Declaration

    Swift

    public protocol RSDSurveyRule
  • RSDComparableSurveyRule is a survey rule that matches an expected result to the answer and vends a skip identifier if the match is evaluated to true.

    See more

    Declaration

    Swift

    public protocol RSDComparableSurveyRule : RSDSurveyRule, RSDComparable
  • RSDComparable can be used to compare a stored result to a matching value.

    See more

    Declaration

    Swift

    public protocol RSDComparable
  • RSDDecimalComparable can be used to compare a stored result to a matching value where the values are decimals.

    See more

    Declaration

    Swift

    public protocol RSDDecimalComparable : RSDComparable
  • RSDStep is the base protocol for the steps that can compose a task for presentation using a controller appropriate to the device and application. Each RSDStep object represents one logical piece of data entry, information, or activity in a larger task.

    Implementations included in this SDK include:

    1. RSDGenericStep is used by RSDFactory to create a step that does not include a recognized subtype.
    2. RSDSectionStep is used to define a logical subgroup of steps.
    3. RSDUIStep is used to define a display step.
    4. 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 RSDStep subclass is usually paired with an RSDStepController that controls the actions of the step.

    See more

    Declaration

    Swift

    public protocol RSDStep
  • RSDGenericStep is a step with key/value pairs decoded from a dictionary. This is the default step returned by RSDFactory for an unrecoginized type.

    See more

    Declaration

    Swift

    public protocol RSDGenericStep : RSDStep
  • RSDSectionStep 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.

    See more

    Declaration

    Swift

    public protocol RSDSectionStep: RSDStep, RSDTask, RSDConditionalStepNavigator
  • RSDUIStep is used to define a single display 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 a RSDSectionStep.

    See more

    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.
    See more

    Declaration

    Swift

    public protocol RSDMutableStep: class, RSDStep
  • RSDThemedUIStep is a UI step that supports theme customization of the color and/or images used.

    See more

    Declaration

    Swift

    public protocol RSDThemedUIStep : RSDUIStep
  • RSDFormUIStep implements additional properties used in creating a form input.

    See more

    Declaration

    Swift

    public protocol RSDFormUIStep: RSDUIStep
  • RSDActiveUIStep extends the RSDUIStep to include a duration and commands. This is used for the case where an RSDUIStep has an action such as start walking or stop walking; the step may also implement the RSDActiveUIStep protocol to allow for spoken instruction.

    See more

    Declaration

    Swift

    public protocol RSDActiveUIStep: RSDUIStep
  • RSDTransformerStep is used in decoding a step with replacement properties for some or all of the steps in a section that is defined using a different resource.

    See more

    Declaration

    Swift

    public protocol RSDTransformerStep: RSDStep
  • RSDJSONNumber implements converting a Swift number to an Objective-C NSNumber.

    See more

    Declaration

    Swift

    public protocol RSDJSONNumber : Codable
  • RSDStepValidator is a convenience protocol for validating the steps in a list as unique.

    See more

    Declaration

    Swift

    public protocol RSDStepValidator
  • RSDDateCoder 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.

    See more

    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 Codable and instead use a dictionary representation.

    See more

    Declaration

    Swift

    public protocol RSDDictionaryRepresentable
  • Protocol for converting objects to JSON serializable objects

    See more

    Declaration

    Swift

    public protocol RSDJSONValue