Protocols

The following protocols are available globally.

  • 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
  • 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 : RSDPermissionsConfiguration
  • An authorization adapter is a class that can manage requesting authorization for a given permission.

    See more

    Declaration

    Swift

    public protocol RSDAuthorizationAdaptor : AnyObject
  • A background task is an extension of a task that can run a task without visual steps. This is intended for use in an active task where the user may need to set down their phone or put it in their pocket but still have the steps continue to transition if the screen has been locked or the phone has gone to sleep.

    See more

    Declaration

    Swift

    public protocol RSDBackgroundTask : RSDTask
  • Custom audio session controller.

    See more

    Declaration

    Swift

    public protocol RSDAudioSessionController : AnyObject
  • A cohort navigation step is a step that carries information about navigation rules to apply either before or after displaying this step based on the currently applied cohorts.

    See more

    Declaration

    Swift

    public protocol RSDCohortNavigationStep : RSDStep
  • RSDCohortAssignmentStep evaluates a task result and returns the cohorts to apply for a given result.

    See more

    Declaration

    Swift

    public protocol RSDCohortAssignmentStep : RSDStep
  • A cohort navigation rule is used by the RSDCohortTrackingRule to determine whether to skip a step, and if so where to skip to, based on the currently applied cohorts.

    See more

    Declaration

    Swift

    public protocol RSDCohortNavigationRule
  • A color mapping holds a reference to a given index within a set of color tiles.

    See more

    Declaration

    Swift

    public protocol RSDColorMapping
  • 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
  • Protocol to describe a task that should be copied for each run of the task rather than simply passed. This is used to allow an architecture where the task model uses a pointer to an in-memory object that is used during navigation.

    See more

    Declaration

    Swift

    public protocol RSDCopyTask : RSDCopyWithIdentifier, RSDTask, RSDTaskTransformer
  • A light-weight protocol for copying objects with a new identifier.

    See more

    Declaration

    Swift

    public protocol RSDCopyWithIdentifier
  • A data archive is a class object that can be used to add multiple files to a zipped archive for upload as a package. The data archive could also be a service that implements the logic for uploading results where the results are sent individually. It is the responsibility of the developer who implements this protocol for their services to ensure that the data is cached (if offline) and to re-attempt upload of the encrypted results.

    See more

    Declaration

    Swift

    public protocol RSDDataArchive : AnyObject, NSObjectProtocol
  • An archivable result is an object wrapper for results that allows them to be transformed into data for a zipped archive or service.

    See more

    Declaration

    Swift

    public protocol RSDArchivable
  • The data archive manager controls vending a new archive (as appropriate) and handling state. It is a composite protocol of the methods defined using Swift, which are required but can include Swift objects and methods that conform to Objective-C protocols which allows for optional implementation of the included methods.

    Declaration

    Swift

    public protocol RSDDataArchiveManager : RSDObjCDataArchiveManager, RSDSwiftDataArchiveManager
  • The data storage manager controls storing of user data that is stored across task runs. It is a composite protocol of the methods defined using Swift, which are required but can include Swift objects and methods that conform to Objective-C protocols which allows for optional implementation of the included methods.

    Declaration

    Swift

    public protocol RSDDataStorageManager : RSDObjCDataStorageManager, RSDSwiftDataStorageManager
  • 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 : Decodable, Encodable
  • 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
  • A light-weight protocol for replacing the mutable properties on a class with values from a decoder.

    See more

    Declaration

    Swift

    public protocol RSDDecodableReplacement : AnyObject
  • A special-case encodable that can be encoded to a comma-delimited string.

    A csv-formatted file is a smaller format that might be suitable for saving data to a file that will be parsed into a table, but the elements must all conform to single value container encoding and they may not include any strings in the encoded value.

    See more

    Declaration

    Swift

    public protocol RSDDelimiterSeparatedEncodable : Encodable
  • A task that implements this module is expected to include a pointer to the design system UI/UX rules to use that are specific to the tasks within this module.

    See more

    Declaration

    Swift

    public protocol RSDTaskDesign
  • RSDUIThemeElement is used to tell the application UI view controllers how to style a given step.

    See more

    Declaration

    Swift

    public protocol RSDUIThemeElement
  • RSDStringEnumSet is a protocol for defining the set of all string values included in an enum.

    Declaration

    Swift

    public protocol RSDStringEnumSet : CaseIterable, Hashable, RawRepresentable where Self.RawValue == String
  • RSDIntEnumSet is a protocol for defining the set of all int values included in an enum.

    Declaration

    Swift

    public protocol RSDIntEnumSet : CaseIterable, Hashable, RawRepresentable where Self.RawValue == Int
  • 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.

    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.

    Declaration

    Swift

    public protocol RSDFactoryEncoder
  • RSDFormUIStep implements additional properties used in creating a form input.

    See more

    Declaration

    Swift

    public protocol RSDFormUIStep : RSDUIStep
  • RSDImageVendor is a protocol for defining an abstract method for fetching an image.

    See more

    Declaration

    Swift

    public protocol RSDImageVendor
  • 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
  • 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 Research framework uses RSDFormUIStep 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
    See more

    Declaration

    Swift

    public protocol RSDInputField
  • RSDPopoverInputField wraps the input field in a form step. This allows the data source used to display the input field to show a form step in a modal view controller.

    Declaration

    Swift

    @available(*, deprecated)
    public protocol RSDPopoverInputField : RSDFormUIStep, RSDInputField
  • RSDDetailInputField is an input field that can be presented as a step using the given transition style.

    See more

    Declaration

    Swift

    public protocol RSDDetailInputField : RSDInputField, RSDUIStep
  • Extend the input field to a mutable type.

    See more

    Declaration

    Swift

    public protocol RSDMutableInputField : AnyObject, RSDInputField
  • Extend the input field to allow copying the field with a new identifier.

    See more

    Declaration

    Swift

    public protocol RSDCopyInputField : RSDInputField
  • This is a custom type of UI step that is used to show instructions, permissions, and/or a countdown for a task.

    See more

    Declaration

    Swift

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

    See more

    Declaration

    Swift

    public protocol RSDJSONNumber : Decodable, Encodable
  • Casting for any a JSON type object. Elements may be any one of the JSON types (NSNull, NSNumber, String, Array, Dictionary).

    Note

    NSArray and NSDictionary do not implement this protocol b/c they cannot be extended using a generic where clause.

    Declaration

    Swift

    public protocol RSDJSONSerializable
  • 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
  • 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
  • A navigation skip rule applies to this step to allow the step to be skipped.

    See more

    Declaration

    Swift

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

    See more

    Declaration

    Swift

    public protocol RSDNavigationBackRule
  • RSDOverviewStep extends the RSDUIStep to include general overview information about an activity including what permissions are required by this task. Without these preconditions, the task cannot measure or collect the data needed for this task.

    See more

    Declaration

    Swift

    public protocol RSDOverviewStep : RSDStandardPermissionsStep, RSDUIStep
  • 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
  • An RSDPermission can carry additional information about the permission

    See more

    Declaration

    Swift

    @objc
    public protocol RSDPermission : AnyObject
  • RSDReminderUIAction implements an action for setting up a local notification to remind the participant about doing a particular task later.

    See more

    Declaration

    Swift

    public protocol RSDReminderUIAction : RSDUIAction
  • 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
  • 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 Encodable protocol to allow the app to store and upload results in a standardized way.

    Note

    The RSDResult protocol requires conformance to the Encodable protocol but does not require conformance to Decodable. This allows using class objects that cannot be extended to conform to the Decodable protocol, such as ORKResult classes.
    See more

    Declaration

    Swift

    public protocol RSDResult : Encodable
  • A result summary step is used to display a result that is calculated or measured earlier in the task.

    See more

    Declaration

    Swift

    public protocol RSDResultSummaryStep : RSDUIStep
  • 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 : Decodable, Encodable
  • A protocol that can be used to define the keys and header to use in a string-separated file.

    See more

    Declaration

    Swift

    public protocol RSDStringSeparatedEncodingFormat
  • The RSDSchedule protocol can be used to describe a local notification schedule. This provides a shared interface for getting and setting the time of day and for setting up notifications.

    See more

    Declaration

    Swift

    public protocol RSDSchedule : RSDScheduleTime
  • 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
  • An RSDScoringResult is an archivable result that can also save a json data scoring object for display in a user’s history or to influence future results.

    See more

    Declaration

    Swift

    public protocol RSDScoringResult : RSDArchivable, RSDResult
  • 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, RSDStepNavigator, RSDTask
  • 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
  • RSDCopyStep is a step that supports creating a copy of itself that has specified properties mutated to return a new instance and/or includes mutated properties.

    See more

    Declaration

    Swift

    public protocol RSDCopyStep : RSDCopyWithIdentifier, 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
  • RSDStepController handles default implementations for running a step in a task.

    See more

    Declaration

    Swift

    public protocol RSDStepController : AnyObject, NSObjectProtocol
  • 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.

    See more

    Declaration

    Swift

    public protocol RSDStepNavigator
  • An extension of the step navigator to allow inserting a section into the work-flow of this step navigator.

    When using a step navigator that was developed by a third-party, it can be desirable to insert into that task flow steps related to the timing of the task. For example, a tapping task may also include asking about medication or a 12 minute run may prompt a clinic participant to put on their Fitbit before running. These additional questions or instructions need to be inserted into the task flow at a logical point after showing one or more initial screens.

    See more

    Declaration

    Swift

    public protocol RSDCopyStepNavigator : RSDStepNavigator
  • RSDStepTransformer is used in decoding a step with replacement properties for some or all of the properties that is defined using a different resource.

    See more

    Declaration

    Swift

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

    See more

    Declaration

    Swift

    public protocol RSDStepValidator
  • 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 : Decodable, Encodable, OptionSet
  • 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 : RSDComparable, RSDSurveyRule
  • Delegate for the data source.

    See more

    Declaration

    Swift

    public protocol RSDTableDataSourceDelegate : AnyObject, NSObjectProtocol
  • RSDTableDataSource is the model for a table view controller. It provides the UITableViewDataSource, manages and stores answers provided through 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 view controller.

    The tableView data source is comprised of 2 objects:

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

    2. RSDTableItem: An object representing a specific table cell. There will be one RSDTableItem for each indexPath in the tableView.

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

    See more

    Declaration

    Swift

    public protocol RSDTableDataSource : RSDStepViewPathComponent
  • RSDTableStep is a UI step that can be displayed using a UITableView.

    See more

    Declaration

    Swift

    public protocol RSDTableStep : RSDUIStep
  • RSDTask is the interface for running a task. It includes information about how to calculate progress, validation, and the order of display for the steps.

    See more

    Declaration

    Swift

    public protocol RSDTask
  • 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 : AnyObject, NSObjectProtocol
  • RSDTaskController handles a base-level implementation for running a task. This object is expected to be an appropriate instance of a view controller, depending upon the operating system.

    To start a task, create an instance of a view controller that conforms to this protocol and set the task, taskInfo, or taskViewModel.

    See more

    Declaration

    Swift

    public protocol RSDTaskController : AnyObject, NSObjectProtocol
  • A compact object for storing information about a task run that can be used by a task to influence subsequent task runs.

    See more

    Declaration

    Swift

    public protocol RSDTaskData
  • 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
  • RSDTaskInfo includes information to display about a task before the task is fetched. This can be used to display a collection of tasks and only load the task when selected by the participant.

    See more

    Declaration

    Swift

    public protocol RSDTaskInfo : RSDCopyWithIdentifier
  • 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
  • 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 : RSDAnswerResultFinder, RSDResult
  • The RSDTaskRunResult is a task result where the task run UUID can be set to allow for nested results that all use the same run UUID.

    See more

    Declaration

    Swift

    public protocol RSDTaskRunResult : RSDTaskResult
  • RSDTaskTransformer The task transformer is a lightweight protocol for vending a task. This can be used by an RSDTaskInfoStep 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.

    See more

    Declaration

    Swift

    public protocol RSDTaskTransformer : AnyObject
  • A tracking rule is used to track changes that are applied during a task that should be saved at the end of the the overall task. By definition, these rules can mutate and should be handled using pointers rather than using structs.

    See more

    Declaration

    Swift

    public protocol RSDTrackingRule : AnyObject
  • The tracking task protocol is intended for tasks that use scoring data from a previous task run to inform subsequent runs of the same task by a given participant. RSDTaskViewModel will check a task for conformance to this method when the view model is initialized.

    Note

    Because sometimes it is actually the step navigator attached to a task that uses the previous run data, the tracking task does not inherit from RSDTask.

    Seealso

    RSDTaskObject for example implementation.

    See more

    Declaration

    Swift

    public protocol RSDTrackingTask
  • RSDUIActionHandler implements the custom actions of the step.

    See more

    Declaration

    Swift

    public protocol RSDUIActionHandler
  • 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
  • RSDVideoViewUIAction implements an extension of the base protocol where the action includes a pointer to a url that can display a video in an AVPlayerViewController. 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 RSDVideoViewUIAction : RSDResourceTransformer, RSDUIAction
  • 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 : RSDResourceTransformer, RSDUIAction
  • 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