Is there an (elegant or preferred) way to convert a DateComponents object to a String and back so that
DateComponents -> String -> DateComponents
is alway possible and the resulting object equals the original object? (not identical) (like
there is an
that is able to do this trick, converting back and forth.
there is a
, but it appears to me not to support the direction from
motivation for this question
HealthKit used to store birthdays as
up to iOS 9.x.
Starting with iOS 10, HealthKit uses
as a model for birthdays. (And deprecated
I'm trying to reflect HealthKits model change in my own data model of a HealthKit centric app. The most straight forward is to use
in my model as HealthKit does.
As I need to save my model to a file and load it again, the answer to this question would enable me to do this.
The obvious fallback is to convert
and save that. But there must be a good reason why Apple deprecated