I am new to iOS development, so I would appreciate some feedback.
I am trying to create an iOS client for my web service. So far this is what I have done:
I implement two views (utility-based application using storyboards). In the main view, I use a text box and a search button, where the user can enter a query, and then click the search button. After clicking the search button, my intention is to read the value of the text field and use it in my callback to my web service. My web service responds using a JSON file with the results of a query that I parse and display in the secondary view area.
I know how to make a calm call in iOS and how to do JSON parsing and also display the results on the screen (at least the text, but this is another question). But my intention is to learn and implement the basics of MVC for my application.
In accordance with MVC, the controller updates the view, and the model sends a notification that the controller can listen to and know if there are any changes in the object. So this is what I would ideally like:
My model. My model will handle the main RESTful call, receive a JSON response, parse it and get the resulting values that I want to display in the view.
My Controller - I want my controller to listen to my model and get the resulting values from the model and display them in the view.
Using a quick and dirty way, I can implement a RESTful call, parse JSON and display the resulting values - everything is inside the controller, but using this technique, if my view changes tomorrow, then I will have to rewrite my code. Or, if I want to add new features, I have to change my controller. Therefore, ideally, I would like to have a basic model that does not know what the view looks like, and just let the controller take the results from the model and display them in the view.
From what I read from Google's search results, there are still two ways to do this: a) Monitoring key values and b) Notification Center.
Over the past 2 days, I have been trying to find a good decent way to implement the Notification Center or learn more about it, I do not get a good result. Some of the questions I have, can I send the value of a String result using the Notification Center that my controller receives? How does the notification center really work with string values? Where can I find good examples?
Therefore, any help in this regard would be greatly appreciated.