This is a very broad / vague question, but here. I apologize in advance.
The application (desktop application) that I create uses different types of input to generate a QR code (I just build it to learn Obj-C / Cocoa). The user can switch between different views that allow you to enter text text (one text field), VCard / MeCard data (several text fields) and other materials. Regardless of the input, the result is a QR code.
To save everything, I would like to use representations as view controllers, so they process their own inputs and can simply "send" general "data to encode" an object containing all the data to a central encoder. That is, a data object with the text of the text field will be created in the text view, and the VCard / MeCard view will use all its fields to create structured VCard / MeCard data.
I can bind all this together manually in the code, but I would really like to know how bindings / KVOs can help me. Alas, after reading the Apple developer docs and the simpler tutorials / examples I could find, I'm still not sure how to apply it to my application.
For example: A user edits text fields in a VCard window. The VCard view controller is notified of each update and "recounts" the data object. The central controller of the encoder is then notified of the updated data object and encodes the data.
The point of all this is that input representations can be created completely independently and can contain all types of input fields. They then process their own inputs and โreturnโ a common data object that the encoder can use. Internally, the gazes observe their inputs to update the data object, and externally, the encoder only needs to observe the data object.
The problem is that I have no idea how to do this and keep it untied. Should there be an object controller between input-representation and its fields? Should there be a different one between presentation and encoder? What do I need, where? If anyone has a link to a good tutorial, share it.
Again, I can collapse my own notification system and glue code, but I think this should be avoided.