Skip to content

ORKNavigationRule accepting a closure as an alternative to ORKResultPredicate #531

@md0u80c9

Description

@md0u80c9

The proposal would be to extend ORKPredicateStepNavigationRule to take a closure as an alternative to ORKResultPredicate.

Example case: your study may contain multiple surveys/forms. Or you may have data from other areas (HealthKit being the obvious example).

Your application could then have significantly better logic from external variables, without having to resort to subclassing.

In my application example, we have some data stored in Core Data (demographics) - if the data is already present (because they have entered data from an earlier survey) we won't want to ask it in any subsequent survey. If it's not present we will ask it and then as part of our result parser put the data into Core Data.

If your application picked up an anomaly on HealthKit that might lead to a change in your survey questions (eg. diabetic has an abnormal blood sugar result from HealthKit you may want to ask extra dietary intake questions).

The closure would either return a boolean state: true ( go to the specified destination), or false. It could alternatively conceivably return a String state (destinationStepIdentifier), allowing effectively a switch-type predicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions