0

リサーチキットフレームワークを使用して、Swift でアプリを開発しています。調査中にユーザーが入力した回答は、ローカル データベースに保存されています。ユーザーが再び調査を開始したときに、以前に選択した回答を表示できるように、アプリケーションに機能を実装する必要があります。作成された ORKOrderedTask にデフォルトで選択された値を設定できますか。

以下は、使用されるコード スニペットです。

var steps = [ORKStep]()
let questQuestionStepTitle = "What is your quest?"
let textChoices = [
    ORKTextChoice(text: "Create a ResearchKit App", value: 0),
    ORKTextChoice(text: "Seek the Holy Grail", value: 1),
    ORKTextChoice(text: "Find a shrubbery", value: 2)]
let questAnswerFormat: ORKTextChoiceAnswerFormat =     ORKAnswerFormat.choiceAnswerFormatWithStyle(.SingleChoice, textChoices: textChoices)
let questQuestionStep = ORKQuestionStep(identifier: "TextChoiceQuestionStep", title: questQuestionStepTitle, answer: questAnswerFormat)
steps += [questQuestionStep]
return ORKOrderedTask(identifier: "SurveyTask", steps: steps)

オプションのデフォルトの選択値を設定できますか?

4

1 に答える 1