Introduction to XCode IDE
XCode is an integrated development environment developed to work on Mac operating systems. It contains a suite of software development tools developed by apple. XCode facilitates us to develop software for macOS, tvOS, iOS, and watchOS. The latest stable release of XCode is 11.0, which is available on the Mac App Store for all the users of macOS Mojave. In this section of the tutorial, we will go through various contexts of XCode. We will also go through multiple sections of XCode.
The latest version of XCode i.e., Version 11, can be installed on macOS Mojave from the Apple Mac App store. However, in this tutorial, we are going to use XCode 10.2.1
A Quick walkover of XCode
Let's have a quick walkover of XCode 10.2.1 and understand how the development in XCode is going to be done.
When we create a new XCode Project, the following window is shown which provides the target information of the XCode Project. It shows every information of the project that includes Bundle Identifier, App version, Build Version, Signing Information, Deployment Information, Linked Binaries and framework information, and application launch icons.
Above the target information, there is a pane of project information which shows all the information about the project given in the following image. It contains information about the iOS version for which the application is created. It also contains release information.
We will discuss the target and project information later in this tutorial in detail.
Now let's look at all the components of an XCode window (below image) in detail.
The standard editor is shown in the middle of the window. As the name suggests, it is the standard editor of the project in which the project files are edited. It contains the information about the file commented at the top and the initial View Controller class file with the lifecycle method created. (The lifecycle methods will be discussed later in this tutorial. At the topmost pane of the Standard editor, the hierarchical information about the project file is shown. It can also be used to open other files in the same editor. However, we can also navigate to other project files using the project navigator also.
The Assistant Editor is mainly used to create outlets of the storyboard components (Textfield, Label, etc.) in the corresponding View Controller class file. However, the Assistant editor facilitates us to look at two files in the editor simultaneously.
The project navigator is shown at the left of the window. It shows the file structure of the project. It is used to navigate through the project. Initially, an XCode project contains the files shown in the following image.
The inspectors are shown in the right of the XCode window, as shown in the below image. The file inspector shows the full information about the corresponding swift file opened in the standard editor. It contains the Name, Type, Location, and the interface builder document-related information.
Quick help inspector
It is used to provide help to the user where it can search the documentation about the syntax. It is shown as the below image.
Identity Inspector is mainly used when we need to work with the storyboard. It shows information about storyboard components (View Controllers) and their corresponding Swift class files. To program the storyboard components accordingly, we need to assign class files to them. All this information is shown by Identity Inspector, as shown in the below image. It prompts the developer to assign class and module to the corresponding storyboard View Controller. It also prompts the developer to assign the identity name to the View Controller, which is used throughout the project to identify the View Controller. We can also give some Runtime constraint to the UIView shown in the storyboard.
An attribute inspector is used to give some attributes to the corresponding UIView in the storyboard like content mode, tags, interaction, background color, font color, font size, etc. The attributes given to the storyboard views using attribute inspector are static and can be changed programmatically at runtime.
Size inspector provides information about the size constraints given to the view while designing using a storyboard. We can alter the size constraint given to the view using the Size Inspector.
It shows the information about the connections of the corresponding storyboard UIView to the swift class file. It contains all the connections of the storyboard to the swift class files.
collection view, etc. which is primarily used to create an iOS application. Using the media library, we can insert the desired widget to the storyboard using drag & drop functionality. We can open the media library using command + shift + L short key.
At the bottom of the Standard Editor, the debugger console is shown, which is used for debugging the program at runtime. The console is also used to print the values using swift the print(), and debugPrint() functions.