I have a subclass of UIView which draws itself based on data held in a corresponding model class, which is a subclass of NSManagedObject.
The problem is, some fields in the data model (e.g. the position of the view) are already held in the view (i.e. the frame property in this case). I then have a data duplication/synchronization problem to solve.
To complicate matters further, the view needs to update in response to changes made to the data model and the data model needs to be updated in responses made to the view (e.g. the user dragging it to a new location).
What's the best way to solve this? Using KVO and references in both directions?
Or is there a better approach?