pkc
pkc

Reputation: 8516

save CMTime in core data + Xcode8 + swift3

I declared two attributes (currentTime and fullTime) as Transformable in data model as shown below.

enter image description here

How to save data in this attribute? Do I need to convert to NSData first? or any other way?

Upvotes: 1

Views: 167

Answers (1)

Tom Harrington
Tom Harrington

Reputation: 70976

Transformable need to be convertible to NSData. When you're using a type that conforms to the NSCoding protocol, that happens automatically. When you're not (as with CMTime), you can't use a transformable unless you create your own custom transformer by subclassing NSValueTransformer.

You may find it easier to simply save the CMTime properties in Core Data and reconstruct the CMTime from those. The properties are all numeric types that Core Data knows how to handle.

Upvotes: 1

Related Questions