Skip to content

Instantly share code, notes, and snippets.

@ashokkumarmw
Last active April 15, 2018 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashokkumarmw/519f6f033fb13d40909b28d66d7e5e81 to your computer and use it in GitHub Desktop.
Save ashokkumarmw/519f6f033fb13d40909b28d66d7e5e81 to your computer and use it in GitHub Desktop.
func getDateOfBirth() -> (dicHealth: [String: Any]?, dob: UInt64?) {
do {
let dateOfBirth = try self.healthKitStore.dateOfBirth()
var dicHealth = [String: Any]()
dicHealth["DateOfBirth"] = dateOfBirth.epoch() // it gets epoch number from the date and there is no issue inside.
dicHealth["TimeZone"] = getTimeZoneString()
return (dicHealth, dateOfBirth.epoch())
} catch _ {
print("Either an error occured fetching the user's age information or none has been stored yet.")
return (nil, nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment