Before getting too far with iOS development, it is really important to get a foundation with Apple's design pattern for developing on iOS. You may have used the MVC (Model View Controller) pattern with other technologies such as ASP.NET, but Apple implements this paradigm in a slightly different way.
The MVC design pattern includes the following:
UIView
. Examples are toolbars, buttons, and anything else the user would see on the screen and interact with.UIViewController
. This is where a good portion of the code in iOS applications resides.The following image shows the MVC design pattern:
To understand this pattern better, let's walk through the following example of a common scenario:
UITextField
textbox and click on the UIButton
button to start the search. This is the view layer.UIActivityIndicatorView
spinner, and call a method in another class to perform the search. This is the controller layer.For more information on Apple's MVC pattern, see the documentation at https://developer.apple.com/library/mac/documentation/general/conceptual/devpedia-cocoacore/MVC.html.
A point to note is that you are free to do anything you want in the model layer of your application. This is where we can use plain C# classes that can be reused on other platforms such as Android. This includes any functionality using the C# Base Class Libraries (BCL), such as working with web services or a database. We'll dive deeper into cross-platform architecture and code-sharing concepts later in the book.
18.118.9.146