// // SurveyTask.swift // RK-Setup-Cocoa // // Created by Gerardo Marx Chávez Campos on 09/10/24. // import ResearchKit // Define a simple survey task func createSurveyTask() -> ORKOrderedTask { // Define a question step with a text answer format let questionStepTitle = "How are you feeling today?" let questionStep = ORKQuestionStep( identifier: "QuestionStep", title: questionStepTitle, answer: ORKTextAnswerFormat(maximumLength: 100) ) questionStep.isOptional = false // Define another question as a scale (e.g., 1 to 10) let scaleAnswerFormat = ORKAnswerFormat.scale( withMaximumValue: 10, minimumValue: 1, defaultValue: 5, step: 1, vertical: false, maximumValueDescription: "Excellent", minimumValueDescription: "Terrible" ) let scaleStep = ORKQuestionStep( identifier: "ScaleStep", title: "Rate your overall well-being", answer: scaleAnswerFormat ) scaleStep.isOptional = false // Create the ordered task with the steps return ORKOrderedTask(identifier: "SurveyTask", steps: [questionStep, scaleStep]) }