包饺子剩下的面团能做什么| 血脂高会导致什么后果| 广西属于什么地区| 房子什么朝向好| 间质性肺病是什么意思| 增大摩擦力的方法有什么| 口干舌燥口苦是什么原因引起的| 梦到掉头发是什么意思| cba新赛季什么时候开始| 拜土地公时要念什么好| 木瓜什么时候成熟| 胳肢窝痒是什么原因| 闲的蛋疼是什么意思| hpv阳性是什么病| 蕴是什么意思| 上火为什么会牙疼| 92年属猴的是什么命| 女性什么时候绝经| 富贵命是什么生肖| pumpkin是什么意思| 为什么做梦会说梦话| 姥姥的妈妈叫什么| 玉米有什么功效| 中医治未病是什么意思| 积什么成什么| 身上红痣多是什么原因| 右侧卵巢多囊样改变是什么意思| 什么是区块链技术| 农历十月十八是什么星座| 豆加支念什么| 铁剂是什么| 80年五行属什么| 中二什么意思| 心悸气短是什么症状| 手指甲的月牙代表什么| hsv病毒是什么意思| 观音菩萨是保佑什么的| 一月19日是什么星座| 头发一把一把的掉是什么原因| 黎山老母什么级别神仙| 女性更年期在什么年龄段| 子午相冲是什么意思| o型血的父母是什么血型| 阴虚湿热吃什么中成药| 须知是什么意思| 菠菜不能和什么一起吃| 肝炎吃什么药| 胃酸胃烧心吃什么药| 浊气是什么| 阿拉伯人属于什么人种| 木色是什么颜色| 吃什么可以消除淋巴结| 胸椎退行性变什么意思| 能量守恒是什么意思| 花子是什么意思| 香蕉和什么不能一起吃| 身体缺钾是什么症状| 病史是什么意思| 大姨妈吃什么| 急性盆腔炎有什么症状表现呢| 华丽的什么| 1951属什么生肖| 预激综合征是什么病| pornhub是什么| 星期一右眼皮跳是什么预兆| hr什么意思| 客套是什么意思| 胆红素阴性是什么意思| 百香果有什么功效与作用| 马凡氏综合症是什么病| 烤冷面的面皮是什么面| 里脊肉炒什么好吃| 长脸适合什么发型| 缺席是什么意思| 掉头发多是什么原因| 包皮什么意思| 胆结石挂什么科| 公务员属于什么行业| 什么人不能吃狗肉| 生日送什么| 凌晨是什么时辰| 雅漾属于什么档次| 牡丹花什么颜色| 胃胀吃什么药好| 脚真菌感染用什么药最好| 肾结石要注意些什么| 中医学专业学什么| 什么叫化疗为什么要化疗| 最好的补钙方法是什么| 白细胞低是什么原因| 三代试管是什么意思| horns是什么意思| 白羊跟什么星座最配| 双肺间质性改变是什么意思| 嗓子发炎是什么原因引起的| 补骨脂是什么东西| 成人礼送什么礼物| 用什么泡脚可以去湿气| 两鬓斑白是什么意思| 苹果五行属什么| 什么牌子的空调最好| 夭寿是什么意思| 相亲第一次见面送什么礼物好| 槟榔长什么样子| 食用碱是什么| 脱髓鞘是什么病| 吃什么可以去湿气| 三高是什么| 手麻什么原因| 犯花痴什么意思| 蟾蜍属于什么动物| 舌苔厚发黄是什么原因| 抚今追昔的意思是什么| 眼角发白是什么原因| 毛囊是什么| 什么手机便宜又好用| 什么飞机| 大乔叫什么| 霸凌是什么意思| 郑中基为什么娶余思敏| 什么操场| 驴血是什么颜色| 耳鸣是什么原因造成的| 老人爱睡觉什么征兆| 春天穿什么衣服| 绿豆汤不能和什么一起吃| 镶什么牙实惠耐用| 一月10号是什么星座| 视频是什么意思| 白萝卜煮水喝有什么功效和作用| 凌晨1点是什么时辰| 脸红是什么大病的前兆| 射进去什么感觉| 肛门瘙痒用什么药膏| 什么水果有助于减肥| 耳朵后面痒是什么原因| 吃了龙虾后不能吃什么| 反应性细胞改变是什么意思| 女孩月经不规律是什么原因| 血管检查什么方法最好| 肚子受凉吃什么药| 一棵树是什么品牌| wt什么意思| 代谢是什么| 什么菜煮不熟| 胸前出汗多是什么原因| 小孩咬人是什么原因| 跳蛋什么意思| 放疗是什么| 做梦吃饺子是什么意思| 白酒兑什么饮料最好喝| 肾结晶是什么病| 鸡婆是什么意思| 鹿晗什么时候回国的| 勾心斗角是什么意思| 琼玖是什么意思| 肾病有什么症状| 妈妈的姑姑叫什么| 一个兹一个子念什么| 结膜出血用什么眼药水| 4月29日是什么星座| 猪头肉炒什么好吃| 撩是什么意思| 半夜胎动频繁是什么原因| 落幕是什么意思| 进字五行属什么| 补气吃什么食物| 美国为什么不敢动朝鲜| 宰相肚里能撑船是什么意思| 衣字旁有什么字| 掉头发多是什么原因| 豌豆炒什么好吃| 最高检检察长什么级别| 手上长水泡是什么原因| 阴疽是什么意思| 吸水石是什么石头| 体贴是什么意思| 月相是什么意思| 老人出汗多是什么原因| 什么水能喝| 天蝎座女和什么星座最配| 梦见孩子被蛇咬是什么意思| 爬山带什么食物比较好| 胎菊和金银花一起泡水有什么效果| 5月6号是什么星座| 蝉代表什么生肖| 半边脸发麻是什么原因| 礼是什么意思| 灯红酒绿是什么意思| 升结肠ca是什么意思| 阴险表情什么意思| 月经期间洗澡会有什么影响吗| 除湿气吃什么好| 强迫症是什么意思| 煤气是什么味道| 十二月二十七是什么星座| 吃什么清肺养肺| 什么的走路| 口臭口干口苦是什么原因| 肝s4钙化灶是什么意思| 1979属什么生肖| 什么是再生纤维素纤维| 红豆杉是什么植物| 昙花什么时间开花| 甲胎蛋白是什么意思| 膝盖疼是什么原因引起的| 用苦良心是什么意思| 人为什么要洗澡| 夏天吃什么| 马步鱼是什么鱼| 二氧化碳低是什么原因| 感冒什么时候传染性最强| 菠萝是什么意思| 不想怀孕有什么办法| 血半念什么| 头晕呕吐是什么原因| 小孩血糖高有什么症状| 十月十日什么星座| 纵欲是什么意思| 公费医疗什么意思| 退工单是什么| ct 是什么| 榴莲补什么| 开团什么意思| 成吉思汗和忽必烈是什么关系| 为什么月经量少| 军师是什么意思| 男鼠配什么生肖最好| 月经为什么是黑色的| 绿色洋桔梗花语是什么| 江西庐山产什么茶| 14年属什么| 上不来气是什么原因| 火车代表什么生肖| 世界上最大的鱼是什么鱼| 做肠镜前一天可以吃什么| 唾液酸是什么| 肾结石炖什么汤喝最好| 画饼什么意思| 浓茶喝多了有什么危害| 脯氨酸氨基肽酶阳性是什么意思| 球镜是什么| 身主天相是什么意思| 菊粉是什么| 健硕是什么意思| 四个一是什么字| 95年什么命| 什么是腺体| 入园体检都检查什么| 什么样的伤口算开放性| lt是什么| 无大碍是什么意思| 防蓝光眼镜有什么好处| 女人下巴有痣代表什么| imao什么意思| bp在医学上是什么意思| 什么是圣人| 风疹病毒抗体igg阳性是什么意思| 梦见鳄鱼是什么预兆| 牙疼吃什么药效果最好| 女性尿频尿急挂什么科| 什么东西醒酒| 缘字五行属什么| 子宫后位什么意思| 百度

View in English

  • Global Nav Open Menu Global Nav Close Menu
  • Apple Developer
Search
Cancel
  • Apple Developer
  • News
  • Discover
  • Design
  • Develop
  • Distribute
  • Support
  • Account
Only search within “”

Quick Links

5 Quick Links

Videos

Open Menu Close Menu
  • Collections
  • Topics
  • All Videos
  • About

More Videos

  • About
  • Transcript
  • 《闪光少女》“重返十七岁” 徐璐穿制服领舞

    百度 波普罚进技术犯规罚球,库兹马又飚中三分,湖人将领先优势夸大至7分。

    Learn how ResearchKit and CareKit can work together to take the tedium out of paper surveys. Code along with us and build a working care pilot app. Explore best practices for onboarding and consent with ResearchKit, and find out how your app can require participants to sign consent documents by leveraging CareKit's store and UI components. This is the first session in a three-part Code-Along series. To get the most out of this series, we recommend that you have some basic familiarity with both ResearchKit and CareKit. For more background, watch "ResearchKit and CareKit Reimagined” from WWDC19.

    Resources

    • HealthKit
    • Research and care app code-along source repository
    • Research and Care Website
      • HD Video
      • SD Video

    Related Videos

    WWDC21

    • Build a research and care app, part 2: Schedule tasks
    • Build a research and care app, part 3: Visualize progress
  • Search this video…

    ? Bass music playing ? ? Erik Hornberger: Good afternoon, everyone, and thank you for joining us today. We’ve got some great content planned out for you. We’re going to walk through a code-along where you and I will build out a research and care app together. ResearchKit is an open source iOS framework that Apple maintains in collaboration with our GitHub community. It provides UI elements for gathering consent, administering surveys, and recording sensor data while participants perform activities, such as physical or cognitive exercises. CareKit, likewise, is also a fully open source framework, and it’s designed to help with building out patient-facing care apps. It excels at scheduling tasks that you want patients to perform, like taking medications or calling their doctor. It also provides a secure persistence layer for health-related data and has utilities for charting. Now, in past WWDC sessions, we’ve often discussed these two sibling frameworks in isolation, but this year we’re going to show you how they can be used together to create even better experiences for patients... Sorry. Should we just -- I should have had it on silent. Do we cut? Crew: No, just answer it.

    Erik: Yo, Jamie. What's up? Jamie: Hey, Erik. I know you’re busy prepping for WWDC right now, but I wanted to tell you that funding just came through for our physical therapy study app! This cutting-edge research is going to help so many people! So, do you think we can get a first rev of the app out, like, right away? Erik: Hey, Jamie, that is -- that is awesome news, and I'm -- I'm really excited about it. The thing is we're just very much in the middle of our- of our Dub Dub code-along. Jamie: Oh, so you're coding already? That's perfect! So, the app is going to be called "Recover." It’s going to be a physical therapy app to help participants strengthen their knees following surgery, and it’s going to be a game changer! I’ve got tons of great ideas, but first, it’s really important that participants consent to participating in the study before we let them start using the app. We’ve got to explain to them all the legalese, but I really want to do it in a way that isn’t intimidating, you know? We’ll also need to get a signature from participants and have them agree to share data with us as well. Uh, one sec, Erik. I’m getting a message from the clinical team. Oh, wow. It looks like the first participants will be released from post-op on Monday. Erik, can you just get started with onboarding for now? I have to catch up with the rest of team, but I’ll call you back in a bit! This is going to be great! Erik: OK. Uh... Alrighty then! I guess this is just going to be our code-along now! So let's -- let's see if we can finish up onboarding before Jamie gets out of that meeting! So, for this session, let’s focus on onboarding and consent. Explaining to the participant what data we’re going to collect, who's going to have access to it, what it’ll be used for, how long it will be retained -- and making all of that easy to understand -- is of paramount importance to a good study. We’re going to show you some new best practices for ResearchKit that will help you get this very important part of your app just right. And as a bonus, we’re going to demonstrate a clever way to bake that onboarding and consent flow right into a CareKit-based app. Specifically, we’re going to set up a standard CareKit app, but in a way that participants must complete onboarding before the care plan’s contents are revealed. As part of that consent and onboarding flow, we’re going to build out some instruction steps telling the participants about what they’re about to be asked to do. We’ve found that orienting participants like this, before jumping into the actual consent parts, really helps improve their experience. We’ll show you how to collect a signature, and we’ll also demonstrate how to use ResearchKit to ask for authorization for HealthKit, notifications, and device motion all up front, all as part of onboarding. If you’d like to follow along, you can find the starter project in the session resources. Let’s open Xcode and get started! This is where we’ll be starting from. We're going to be touching four files today. First is the AppDelegate. This is where we're going to be interacting with CareKit’s store. Over in Surveys.swift, we’ll be writing out some surveys using ResearchKit. Next up, we've got the CareFeedViewController and InsightsViewController, where we’ll be building out the UI for our app. Now, if you run the starter app, you’ll see that there’s actually not much there right now. It's just the OCKDailyPageViewController with no content. It allows us to jump around between days, but there’s nothing there yet. It’ll be our job to fill all of that in. There’s also the Insights tab down here in the corner, and we'll be returning to that during part three. Now, what we want to do is make a consent card show up here in the participant’s feed. That consent task will gate access to the rest of the app. Nothing else will show up until it’s been completed, and once it has been, all the other tasks should appear.

    Jumping over here to AppDelegate.swift, our first step will be to persist a CareKit task for onboarding. Now, whenever we create a task, we need to define a schedule that specifies how often the task will appear in the participant’s feed. For onboarding, we’ll use a daily schedule so they’ll be prompted to onboard every day until they finish consenting. Next, we’ll create a task. We give it an ID, which can be anything we want, so long as it’s unique. Random identifiers are fine, but in this case, I’ve just got a constant we’ve defined over here in another file. We also need to pass in the schedule that we just created. We’ll also specify some instructions and indicate that onboarding should not impact adherence. What this means is basically that onboarding won’t count toward filling the completion rings that you see at the top of most CareKit apps. And finally, we can persist the task into our store. We’ll just go ahead and print out a message to let us know if it was successful or not. All right, we’ve got our onboarding task in the store, ready to go, and now, we’re ready to make it appear in the participant’s feed. We’ll hop over CareViewController.swift where we’ll tell CareKit how we want it to be displayed. Here, we’re subclassing OCKDailyPageViewController, which is the calendar and feed that we saw just a moment ago. We’re overriding the prepare listViewController for date method. This method will be invoked each time the user swipes to a new date, and it’s our job to inspect the date, determine what we want to show on that date, and append the appropriate content into the listViewController. Now, the first thing we want to do is check if the participant has finished onboarding or not, since we’ll display different content based on the answer to that question. Let’s drop down a bit further and write out a method to do just that. Inside of our checkIfOnboardingIsComplete method, we’ll create an OCKOutomeQuery, and we’ll query for all outcomes associated with the onboarding task. When our query returns, we’ll check to see if any outcomes were found or not. If there aren’t any, that means onboarding hasn’t finished yet. If there is one, that means that onboarding is already complete. We’ll use our new method right up here, and based on whether or not onboarding is complete, we’ll either show just the consent task or all the other tasks. All right. So far, so good! We now have a mechanism in place for requiring the participant to onboard before letting them into the rest of the app. The next step is to set up that onboarding flow. Right here, we want to create a CareKit task card that presents a ResearchKit survey, but before we can do that, we need to actually create a ResearchKit survey so that we have something to display. We’ll pop over to Surveys.swift and get that taken care of. Let’s stub out our function to start. Our onboarding survey is going to consist of five steps: a welcome step, an instruction step, a signature step, a permissions step, and finally, a completion step. The first is going to be the welcome step, which will be an ORKInstructionStep. We’re going to see a lot of these instructions steps today. Whenever we create a ResearchKit step, we need to give it a unique identifier. You can use any pattern that you’d like, including random identifiers. I’ve found that this key path-inspired approach works really well for me. We’ll also specify a title and some detailText as well as a header image. All right. So up next: step two is going to be our informed consent step, and this will also be an instruction step. But this time, we’re going to add some body items. Body items are basically bullet points, but we have the option to use an image -- and in this case, an SF Symbol -- in place of the bullet. This body item tells participants they’re going to be asked to share some health data. Let’s create a second body item to tell them they’ll be asked to complete tasks and a third to inform them they’ll be asked to provide their signature. Let's add one more to remind them that their data will be kept private and secure. Finally, we’ll insert these body items into our instruction step. And that covers the instructions. Next up is gathering a signature, and fortunately, ResearchKit makes this part really easy. The signature can be collected with an ORKWebViewStep. Setting the showSignature AfterContent property to true prompts ResearchKit to show the signature box at the bottom of the step. We can supply the actual consent document as HTML, and it will be shown right above the signature box. There we go; the signature was pretty quick and easy! The last bit will be requesting permissions. For this fourth step, we’ll collect permissions with the HealthKitPermissionType that my teammate Pariece introduced at WWDC last year. It requires that we specify two sets of HealthKit types: one that’s we’d like permission to write to and one that we’d like permission to read from. This year, we’re introducing two new permission types. The first is ORKNotificationPermissionType, and it allows us to request permission to show alerts, badge the app, and play sounds. We’re also introducing the ORKMotionActivity PermissionType, which will help us ask for access to device motion data. We’ll pass all three of these into a requestPermissionStep, which wraps up our fourth step. The fifth and final step is just going to be a completion step that thanks the participant for joining Jamie’s study. All of these steps will be chained together inside of an ORKOrderedTask. We’ll pass in the steps in the order we’d like ResearchKit to present them and then return the task from this method. All right. Now that we’ve defined the whole onboarding and consent flow, let’s jump back into CareFeedViewController and revisit how to display it from our CareKit-based app. We’re introducing a brand-new class, the OCKSurveyTaskViewController, and it is specifically built for this purpose. Like all other CareKit view controllers, we pass in the ID of the task we’d like to display along with an eventQuery and the storeManager. Additionally, we’ll also need the survey we just created and a closure that translates a ResearchKit result into an array of CareKit outcome values. We’ll revisit this closure in more detail during part two. For now, we’ll just say it's sufficient to persist the date that the participant completed onboarding. We’ll also want to append this task card into our feed. Now, there is actually one more step, and that is to make sure that the feed reloads once the participant finishes onboarding. One way we can accomplish that is by setting ourselves as the survey task view controller’s delegate. Then, down here, we can implement the delegate method, survey task view controller didFinish task with result. In the body of this method, we can check that onboarding was completed successfully, which is basically just to say that the participant didn’t cancel out partway through; they went all the way to the end and completed it successfully. If that’s the case, we can call reload() to refresh the feed. All right, so our onboarding card is set up. When the participant completes onboarding, we’ll save an OCKOutcome and then reload the feed. This is looking good! I think that’s -- that's everything, actually! Let’s run our app and confirm that this all works.

    You can see that we’re being asked to consent before we can begin using the app. And that’s exactly what we want! Let’s tap on the Begin button here, and we'll see that we’re greeted by the welcome step we created just a moment ago. The next step is our instruction step with the body items that we defined. The SF Symbols that we chose really bring it to life. Next up is the signature step, so l’ll just scroll down here and sign that... ...and then we move on to the authorization step. First, we'll authorize HealthKit. Just go ahead and allow that. Next up is notifications, and then device motion. The last page is our completion step that lets us know we’re all done and thanks us for participating. And now we’re back in our Care Feed. Note that we don’t see the prompt to complete consent anymore because we’re done with that now. Instead, this is where all of the true content of our app is going to appear. We’re going to get to that in our next session.

    Hey Siri, can you message Jamie and tell him that we’re done with the onboarding and consent? You can find more info about our frameworks on researchandcare.org. If you’d like to read the source code -- or contribute -- both frameworks are available on GitHub. Please join us again for our next session. I’m going to check with Jamie real quick, and then I’ll rejoin you for part two. See you soon! ?

Developer Footer

  • Videos
  • WWDC21
  • Build a research and care app, part 1: Setup onboarding
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • App Extensions
    • App Store
    • Audio & Video
    • Augmented Reality
    • Design
    • Distribution
    • Education
    • Fonts
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning
    • Open Source
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Tutorials
    • Downloads
    • Forums
    • Videos
    Open Menu Close Menu
    • Support Articles
    • Contact Us
    • Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Get the Apple Developer app.
    Copyright ? 2025 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines
    经常打饱嗝是什么原因 果冻是什么做的 附件是什么部位 94狗跟什么属相配最好 有胃火口臭怎么办吃什么药
    头皮发痒是什么原因引起的 跳空缺口是什么意思 去医院看脚挂什么科 羊水破了什么感觉 白茶什么样的好
    用醋泡脚有什么好处 服中药期间忌吃什么 睡醒后口干口苦是什么原因 柠檬水什么时候喝最好 猫咪来家里是什么寓意
    bgm网络语什么意思 恶病质是什么意思 试纸一条红杠是什么意思 西天取经是什么意思 10月15日什么星座
    减肥可以吃什么水果hcv9jop3ns5r.cn 嗝气是什么原因引起的hcv7jop6ns2r.cn 耳聋是什么原因引起的hcv9jop6ns3r.cn 是什么单位hcv9jop5ns4r.cn 西瓜吃了有什么好处adwl56.com
    羊刃格是什么意思hcv9jop6ns0r.cn 孕妇梦见下雨是什么意思hcv7jop5ns5r.cn 吃饭咬到舌头什么原因hcv9jop4ns0r.cn 晚上9点多是什么时辰hkuteam.com 鳄鱼怕什么jasonfriends.com
    50分贝相当于什么声音hcv9jop3ns8r.cn 鼻子疼是什么原因hcv8jop1ns7r.cn 丑什么生肖hcv9jop3ns3r.cn 手外科属于什么科hcv7jop9ns0r.cn 中央办公厅主任什么级别hcv7jop6ns8r.cn
    黄金为什么这么贵dajiketang.com 上环什么时候去最合适hcv7jop9ns9r.cn 凯乐石属于什么档次hcv8jop8ns1r.cn 6月16日是什么星座hcv8jop7ns0r.cn 双侧上颌窦炎是什么病hcv8jop2ns0r.cn
    百度