I'm trying to implement a NSValue Transformer, which should help me to save a Double Array into Core Data using a Transformable attribute.
So I tried to implement the transformedValueClass. But NSArray.class() is crossed out. Unfortunately I didn't find a reason for this.
My method looks like this:
class PacePerK:NSValueTransformer{
class func transformedValueClass() -> AnyClass!
{
return NSArray.class()
}
}
I get the following compiler errors: Expected member name following '.' Expected identifier in class declaration
Unfortunately they don't really help me.
Why is the NSArray.class crossed out? How can I return the class of NSArray without causing a compiler error?
With the support of all of these properties Swift language is also providing you Transformable property which is very Interestingly Important. Because of this property you can put any type of data into the Core Data without extra overhead. In this tutorial I am going to show you how to use both of these properties...
Out of all of these properties Binary Data is must to be considered. With the support of all of these properties Swift language is also providing you Transformable property which is very Interestingly Important. Because of this property you can put any type of data into the Core Data without extra overhead.
Interface Builder attributes are declaration attributes used by Interface Builder to synchronize with Xcode. Swift provides the following Interface Builder attributes: IBAction, IBSegueAction, IBOutlet, IBDesignable, and IBInspectable.
5. Keep the entity "UseOfDataTypes" selected we are going to create a NSObject Class. Click on the editor && then click on the Create NSmanagedObject Subclass option && follow the instructions until the class with the same name as entity will be created.
It appears the correct why to reference class objects in Swift is with:
NSArray.self
Also, in your example, you’ll need to mark your transformedValueClass function with “override”. So:
class PacePerK:NSValueTransformer{
override class func transformedValueClass() -> AnyClass!
{
return NSArray.self
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With