Khledon
Khledon

Reputation: 181

Adding an array of HKWorkouts to UserDefaults

Is there anyway to add an array of HKWorkouts to UserDefaults or do I have to save the array in core data?

Upvotes: 0

Views: 64

Answers (1)

Allan
Allan

Reputation: 7363

HKObject and its subclasses conform to NSSecureCoding, so you can convert an array of them to Data using NSKeyedArchiver. See the NSKeyedArchiver documentation for more details.

Upvotes: 1

Related Questions