HKQueryAnchor
class, which includes a convenience initializer HKQueryAnchor.init(fromValue: Int)
.Prior to beta 5, the anchor was represented as an
Int
. This made it possible to persist the anchor as an Int
.In beta 5, while I can construct a new HKQueryAnchor from an
Int
, I cannot get the Int
representation of the HKQueryAnchor
.Is there any way to get the
Int
value of an HKQueryAnchor
?
HKQueryAnchor implements NSSecureCoding, so it should be possible to persist this as NSData via a call to NSKeyedArchiver.archivedDataWithRootObject and then using a NSKeyedUnarchiver instance on which you would call decodeObjectOfClass. The problem that I've experienced is that the result from an unarchive call does not appear to be equal to the original value.