You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reflection from Decimal to NSDecimalNumber doesn't work due the following error:
'Unacceptable type of value for attribute: property = "FIELD_NAME"; desired type = NSDecimalNumber; given type = __NSDictionaryM; value = {
"_mantissa" = "";
}.'
Sample code:
var toCoreDataModel = CoreDataType(context: ctx)
let dict = fromModel.toDictionary()
toCoreDataModel = EVReflection.setPropertiesfromDictionary(dict, anyObject: toCoreDataModel, conversionOptions: .DefaultDeserialize)
Apparently a NSDecimalNumber is it's own object with for instance a _mantissa property. If so, then NSDecimalNumber needs to be handled in EVReflection like that or you could make it EVCustomReflectable. I will have a look at this later this weekend.
Activity
evermeer commentedon Feb 8, 2018
Apparently a NSDecimalNumber is it's own object with for instance a _mantissa property. If so, then NSDecimalNumber needs to be handled in EVReflection like that or you could make it EVCustomReflectable. I will have a look at this later this weekend.
denis-ios commentedon Feb 8, 2018
Decimal is a struct (a value type bridged to NSDecimalNumber), I can't make it EVCustomReflectable.
Changing EVReflection seems works from Decimal to NSDecimalNumber:
but doesn't work from NSDecimalNumber to Decimal:
anyObject.setValue(setValue, forKey: key)it leaves the optional Decimal field as nil
Thanks.