This code bit saves: healthKitStore.saveObject(bmiSample, withCompletion: { (success, error) -> Void in if( error != nil ) { println(“Error saving BMI sample: \(error.localizedDescription)”) } else { println(“BMI sample saved successfully!”) } }) The method signature is: saveObject(object: HKObject!, withCompletion completion: ((Bool, NSError!) -> Void)!) This method takes an HKObject which is bmiSample and it takes a completion closure which itself takes a bool & error and returns void. So in our method call, we pass in the bmiSample as the HKObject and for the success and error completion block we say: if error is NOT nil then log that error’s description, else log that the bmiSample was saved successfully. … Read More
Continue Reading