|
Sara Takanashi |
|
Swift |
@IBAction func addPotassiumTapped(sender : AnyObject){
let potassiumType = HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryPotassium)
let potassiumQuantity = HKQuantity(unit: HKUnit.gramUnit(), doubleValue: 0.0055)
let potassiumSample = HKQuantitySample(type: potassiumType!, quantity: potassiumQuantity, startDate: NSDate(), endDate: NSDate())
let healthKitStore:HKHealthStore = HKHealthStore()
healthKitStore.saveObject(potassiumSample, withCompletion: { (success, error) -> Void in
if( error != nil ) {
print("Error saving Potassium sample: \(error!.localizedDescription)")
} else {
print("Potassium sample saved successfully!")
}
})
}
|
Swift |
@IBOutlet weak var aButton: UIButton!
@IBAction func buttonTapped(sender : AnyObject){
let healthKitStore:HKHealthStore = HKHealthStore()
let healthKitTypesToWrite = Set(
arrayLiteral: HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryPotassium)! )
healthKitStore.requestAuthorizationToShareTypes(healthKitTypesToWrite, readTypes:nil){ (success, error) -> Void in
if success == false {
}
}
}
|
Swift |
@IBOutlet weak var aButton: UIButton!
@IBAction func buttonTapped(sender : AnyObject){
let alertController = UIAlertController(title: "My alert", message:
"This is an alert!", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
|
Hirosi Ooguri |
|
Hirosi Ooguri |
|
Hiroshi Ooguri |
|
Mihoko Nojiri |
|
Hitoshi Murayama |
|
Hitoshi Murayama |
|
Tadashi Takayanagi |