I declared two attributes (currentTime
and fullTime
) as Transformable
in data model as shown below.
How to save data in this attribute? Do I need to convert to NSData
first? or any other way?
I declared two attributes (currentTime
and fullTime
) as Transformable
in data model as shown below.
How to save data in this attribute? Do I need to convert to NSData
first? or any other way?
Copyright © 2021 Jogjafile Inc.
Transformable need to be convertible to
NSData
. When you're using a type that conforms to theNSCoding
protocol, that happens automatically. When you're not (as withCMTime
), you can't use a transformable unless you create your own custom transformer by subclassingNSValueTransformer
.You may find it easier to simply save the
CMTime
properties in Core Data and reconstruct theCMTime
from those. The properties are all numeric types that Core Data knows how to handle.