In my app, I’ve a Core Information mannequin that incorporates entities which have properties with remodeled values that use a customized NSSecureUnarchiveFromDataTransformer
I’ve outlined. For instance, from Apple’s pattern code:
class ColorToDataTransformer: NSSecureUnarchiveFromDataTransformer {
override class func allowsReverseTransformation() -> Bool {
return true
}
override class func transformedValueClass() -> AnyClass {
return UIColor.self
}
override class var allowedTopLevelClasses: [AnyClass] {
return [UIColor.self]
}
override func transformedValue(_ worth: Any?) -> Any? {
guard let information = worth as? Information else {
fatalError("Improper information kind: worth should be a Information object; acquired (kind(of: worth))")
}
return tremendous.transformedValue(information)
}
override func reverseTransformedValue(_ worth: Any?) -> Any? {
guard let coloration = worth as? UIColor else {
fatalError("Improper information kind: worth should be a UIColor object; acquired (kind(of: worth))")
}
return tremendous.reverseTransformedValue(coloration)
}
}
extension NSValueTransformerName {
static let colorToDataTransformer = NSValueTransformerName(rawValue: "ColorToDataTransformer")
}
That is included over within the information mannequin as a property’s transformer:
Nonetheless, after I add a brand new mannequin model by deciding on Editor > Add Mannequin Model…
, a warning seems that claims:
no NSValueTransformer with class identify 'ColorToDataTransformer' was discovered for attribute 'tintColor' on entity 'Ebook'
It is a compile-time warning, and never a runtime console log as I’ve seen references to that message being prior to now
That is regardless of making no different code adjustments. How would I appropriate my code/mannequin so the warning goes away? Observe that I’ve already tried every of:
- Setting the
Module
on the attribute toPresent Product Module
- Defining
ColorToDataTransformer
with@objc(ColorToDataTransformer)
- Setting
Suppress all momc warnings
construct setting toSure
None of these made the warning go away, nonetheless. I am presently engaged on an app that targets iOS 16.4 and utilizing Xcode 15.0.1 (15A507)