-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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.