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
They are actually supported, but it's hard to use and confusing.
I evaluated the code and realized why NestedTransformer's code appears to be stupid. tl;dr, delete the ? from typealias TypeOfProperty = NSNumber?.
class OptionalAnyToOptionalNSNumberTransformer: NestedTransformer {
typealias TypeOfData = Any?
typealias TypeOfProperty = NSNumber? // Should be NSNumber, but most people will put in an optional.
func setter(_ dataValue: Any?, type: Any.Type) throws -> NSNumber {
if let number = dataValue as? NSNumber {
return number
} else if let string = dataValue as? String, let integer = Int(string) {
return NSNumber(integerLiteral: integer)
} else {
throw OptionalAnyToOptionalNSNumberTransformerError.unrecognizedNumber(given: dataValue)
}
}
func getter(_ propertyValue: NSNumber) throws -> Any? {
return propertyValue
}
}
The text was updated successfully, but these errors were encountered:
They are actually supported, but it's hard to use and confusing.
The text was updated successfully, but these errors were encountered: