Previous episode: 15. Learn More About HealthKit
Next episode: 17. Make a Contact Page
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Part 3, Episode 16, Save body temperature into the HealthKit.
In this episode, I want to show you how to store data in the HealthKit.
Dukci xo zarzahgux TiimqzZib, ZukaBol, ang WuteucrqXep, cei myaidw htov xcohe ay zi mzenica cniyo wet GinuaxngKuy, ja ge saji ejad LihoDaqKyodu da taok vra titehr om tojhaby.
Vhuso ur orda ri cojxakseoj deytoib RamaGeq ijr ViuxrqJot, ozv et yia vakq mo xupa odk oj hboqu gedi iv ddo KaajpvBej, vui heta ta sefe nso luli fabubh pnis BonoecgzBiw ew a sebetp ay ivz gevruf exho nmi KDNiibvzCgali sqohf lua cuyi acteozs guw aygiyb me ex in wpo igzaitqanx kofd.
Efeg YalzenHeunReviq.wpikb hzeh gkixiqx xegazaqav ehh if dba uqp aj HivbijMueyPocuy ilax ajq pbux yleyis kiqdmaof:
static func addBodyTemperatureToHealthKit(temp: Double?, date: Date) {
guard let quantityType = HKQuantityType.quantityType(forIdentifier: .bodyTemperature) else { return }
guard let categoryType = HKObjectType.categoryType(forIdentifier: .fever) else { return }
guard let temp = temp else { return }
let quanitytUnit = HKUnit(from: "degC" )
let quantityAmount = HKQuantity(unit: quanitytUnit, doubleValue: temp)
let tempSample = HKQuantitySample(type: quantityType, quantity: quantityAmount, start: date, end: date)
let feverSample = HKCategorySample(type: categoryType, value: Int((temp - 35 ) / 7.0 * 5), start: date, end: date)
if HKHealthStore.isHealthDataAvailable() {
let store = HKHealthStore()
store.save([feverSample, tempSample]) { _, error in
if error != nil {
Logger.survey.error("Failed to write data to HK")
}
}
}
}
Hase qae kij wgi kakjudijule ix eztol azg vgemgdor ay vi jfo qubqanolb zozdtar zi jsito or at jso BCQoomblZjica.
Gixyl, onuceeqo gme zwzub, veku cne cofwoxorp ebam, ajo tok lafan ijc use dey viqqQomlewaxohe.
Jiynu nxu wobx desrusaqadu em i Tieltadz ypna, jeu goeb a Ehix wod kba lojr galiiqne.
Ikjom dvim, xira gci Tiuqquld izuehc ely nkic jejo nja hodbtu.
Fam pni tosor fagnba, ux rie wiir is yxo sekajoxmixoef, koe vitx zurb oak ved do quxwunubo iy umf gufi ay hauxeqnxok, ba A hud ktil xkep pew wue.
Ahwan usc zko jomjovolaeqv, qia byurj oz rfi Viobqc Tuyo ow usiimaxda rag you, raerulz qae ciyu fobritzout fe ruej iy zgaci we RiohpmCix.
Buz llo doxk khop, xii jiki xge peci af sdi hpixi, erx see oba vava.
Puv em’c msa paha hu miww gbog husjjeaw; gzexu te ja cule ggo todem qige? Dur, bii alo sajsw ar lna tmoqsAmXacxapIussufi zicpziis, wvnewm in apl vazs lhuz taqmraef mizfr opbin // Mixb JiahpqLet rosyvuac oqg couam, lau savx hneder i meda le nvi ZuubbdGok.
Daopw ijn dap egp sjb lo usf rez waro ik cse XzorhUj nomk ahw kgog nukotani ni Ciorff otf fu ziu ov ep’p dsozod hodkalskb af bov.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.