ios - ResearchKit stepResult for a TextChoiceQuestion -


i'm using researchkit's stepresultforstepidentifier method other question types, can't find correct syntax pre-populate results textchoicequestion.

below unsuccessful attempt @ setting result sample textchoice question in orkcatalog. advice on correct approach?

func stepresultforstepidentifier(stepidentifier: string) -> orkstepresult? {      var stepresults = [orkquestionresult]()      if stepidentifier == "textchoicequestionstep" {          var questiondefault = orkchoicequestionresult(identifier: stepidentifier)          questiondefault.choiceanswers?.append("choice_2")          stepresults.append(questiondefault)      }      var defaults = orkstepresult(stepidentifier: stepidentifier, results: stepresults)      return defaults } 

is choiceanswers array nil? when questiondefault.choiceanswers?.append, choiceanswers might nil, might nothing.

instead questiondefault.choiceanswers = ["choice_2"]


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -