2020 Health & Fitness
WWDC20 · 31 min · Health & Fitness
What’s new in ResearchKit
ResearchKit continues to simplify how developers build research and care apps. Explore how the latest ResearchKit updates expand the boundaries of data researchers can collect. Learn about features like enhanced onboarding, extended options for surveys, and new active tasks. Discover how Apple has partnered with the research community to leverage this framework, helping developers build game-changing apps that empower care teams and the research community.
Watch at developer.apple.com ↗Code shown on screen · 8 snippets
instructionStep
let instructionStep = ORKInstructionStep(identifier: "InstructionStepIdentifier")
instructionStep.title = "Welcome!"
instructionStep.detailText = "Thank you for joining our study. Tap Next to learn more before signing up."
instructionStep.image = UIImage(named: "health_blocks")! informedConsentInstructionStep
let informedConsentInstructionStep = ORKInstructionStep(identifier: "ConsentStepIdentifier")
informedConsentInstructionStep.title = "Before You Join"
informedConsentInstructionStep.image = UIImage(named: "informed_consent")!
let heartBodyItem = ORKBodyItem(text: exampleText,
detailText: nil,
image: UIImage(systemName: "heart.fill"),
learnMoreItem: nil,
bodyItemStyle: .image)
informedConsentInstructionStep.bodyItems = [heartBodyItem] webViewStep
let webViewStep = ORKWebViewStep(identifier: String(describing: Identifier.webViewStep), html: exampleHtml)
webViewStep.showSignatureAfterContent = true sesAnswerFormat
let sesAnswerFormat = ORKSESAnswerFormat(topRungText: "Optimal Health",
bottomRungText: "Poor Health")
let sesFormItem = ORKFormItem(identifier: "sesIdentifier",
text: exampleText,
answerFormat: sesAnswerFormat) scaleAnswerFormItem
let scaleAnswerFormat = ORKScaleAnswerFormat(maximumValue: 10, minimumValue: 1, defaultValue: 11, step: 1)
scaleAnswerFormat.shouldShowDontKnowButton = true
scaleAnswerFormat.customDontKnowButtonText = "Prefer not to answer"
let scaleAnswerFormItem = ORKFormItem(identifier: "ScaleAnswerFormItemIdentifier",
text: "What is your current pain level?",
answerFormat: scaleAnswerFormat) textAnswerQuestionStep
let textAnswerFormat = ORKAnswerFormat.textAnswerFormat()
textAnswerFormat.multipleLines = true
textAnswerFormat.maximumLength = 280;
textAnswerFormat.hideWordCountLabel = false
textAnswerFormat.hideClearButton = false
let textAnswerQuestionStep = ORKQuestionStep(identifier: textAnswerIdentifier),
title: exampleTitle,
question: exampleQuestionText,
answer: textAnswerFormat) ORKReviewViewController
let reviewVC = ORKReviewViewController(task: taskViewController.task,
result: taskViewController.result,
delegate: self)
reviewVC.reviewTitle = "Review your response"
reviewVC.text = "Please take a moment to review your responses below. If you need to change any answers just tap the edit button to update your response." ORK3DModelStep
let usdzModelManager = ORKUSDZModelManager(usdzFileName: "toy_drummer")
usdzModelManager.allowsSelection = false
usdzModelManager.highlightColor = .yellow
usdzModelManager.enableContinueAfterSelection = false
usdzModelManager.identifiersOfObjectsToHighlight = arrayOfIdentifiers
let threeDimensionalModelStep = ORK3DModelStep(identifier: drummerModelIdentifier,
modelManager: usdzModelManager) Resources
Related sessions
-
36 min -
21 min