Here is the program code
var ans : Double = 0.0 let sampleTypeBlood=HKSampleType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBloodGlucose) self.readMostRecentSample(sampleTypeBlood!, completion: { (mostRecentBlood, error) -> Void in if( error != nil ) { print("Error reading weight from HealthKit Store: \(error.localizedDescription)") return; } var blood: HKQuantitySample blood = (mostRecentBlood as? HKQuantitySample)!; ans = blood.quantity.doubleValueForUnit(HKUnit.moleUnitWithMolarMass(HKUnitMolarMassBloodGlucose)) // с этой строчкой возникают проблемы self.txtBox.text = String(ans)