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
{{ message }}
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.
Right now OR supports value transformation for dates in a common format, or (implicitly) dates in other formats by overriding defaultFormatter in NSManagedObject subclasses.
It would be convenient to support a more generic kind of value transformation. Two ideas:
Option 1 - Formatter Classes
Add a mappings property for formatter that takes an NSFormatter subclass as a value. When a formatter is present, the value for that key is processed through -[FormatterInstance getObjectValue:forString:errorDescription:] before updating the record. Here's an example usage:
Right now OR supports value transformation for dates in a common format, or (implicitly) dates in other formats by overriding
defaultFormatter
inNSManagedObject
subclasses.It would be convenient to support a more generic kind of value transformation. Two ideas:
Option 1 - Formatter Classes
Add a
mappings
property forformatter
that takes anNSFormatter
subclass as a value. When a formatter is present, the value for that key is processed through-[FormatterInstance getObjectValue:forString:errorDescription:]
before updating the record. Here's an example usage:A caveat would be that we'd presumably need to store any instances of formatters in thread dictionaries, as they may not be threadsafe.
Option 2 - Inline Blocks
Add a
transform
block tomappings
, for inline value formatting. Example:Managing thread safety would be up to the user (and therefore NMP), though this way would probably have more code duplication.
The text was updated successfully, but these errors were encountered: