Basics of Code Writing for iOS Apps
Let’s start with how to create a custom view in an iOS app. First, you have to add such a view to a scene. Then you will need to set the class of the view to a custom subclass using the Identity inspector. Of course, you will need to implement the class for this custom view.
In addition to the custom view classes, you need to write the code for the model and the controllers (or view controllers in iOS terminology).
For all of these elements, you need to create Objective-C classes. To create a class, any class, follow these steps:
The set of file templates appears.
Select Cocoa Touch and Objective-C class, then click Next
A dialog box for naming the class appears.
Name the class and set the superclass. Then click Next.
A dialog box for saving the file appears. This dialog box also allows you to set the project target for the file
Set the target of the file to be the current project and save the file in the project’s folder.
Check the box next to the target to make the class you added a member of the target. Note that the default directory shown is the project’s folder. Just stay with the default.
Two files are added to the project — an interface file (.h) and an implementation file (.m) — both with boilerplate code specific to the kind of class they represent (for example, the superclass of the new class).