Swift iOS 24-Hour Trainer. Mishra Abhishek

Чтение книги онлайн.

Читать онлайн книгу Swift iOS 24-Hour Trainer - Mishra Abhishek страница 6

Swift iOS 24-Hour Trainer - Mishra Abhishek

Скачать книгу

(iPhone, iPad, or Universal).

      To uniquely identify your application in the iTunes store (and on an iOS device), each project must have a unique identifier. This identifier is known as a bundle identifier and is created by combining the name of the project along with a company identifier that you provide in the project options dialog box. It is best to provide your website domain name in reversed format as the company identifier because domain names are guaranteed to be globally unique.

      Checking the Use Core Data checkbox will add necessary boilerplate code to allow your application to persist objects into a database using Core Data. Core Data is covered in Lesson 26; for the moment you can leave this box unchecked.

      Checking the Include Unit Tests and Include UI Tests checkboxes will create a project that includes unit interface tests and user tests, topics that are covered in Lessons 33 and 34, respectively. For the moment you should leave these boxes unchecked.

      When you click Next, Xcode will ask you to provide a location on your Mac where you would like to save the new project. Toward the bottom of this dialog box, you have the option to create a new Git repository for version control. Version control is beyond the scope of this book, so just uncheck the Source Control option in the dialog box.

      An Overview of the Xcode IDE

The Xcode IDE features a single window, called the workspace window (Figure 2.4), where you get most of your work done.

Figure 2.4

      The Navigator Area

The left side of the workspace window is the navigator area (Figure 2.5).

Figure 2.5

The navigator area consists of eight tabs; each of these tabs (called navigators) shows different aspects of the same project. You can switch between navigators using the navigator selector bar at the top of the navigator area (Figure 2.6).

Figure 2.6

      The Project Navigator

The project navigator (Figure 2.7) shows the contents of your project. Individual files are organized within groups that are represented as folders in a tree structure. The top-level node of this tree structure represents the project itself. These groups are purely logical and provide a convenient way to organize the contents of your project. A group may not necessarily correspond to actual folders on your hard drive.

Screenshot of Xcode IDE Project Navigator with two groups, Hello World and Products.

Figure 2.7

      When a new project is created, Xcode will create two groups (folders) under the project node. Figure 2.7 shows what the project navigator would look like if you were to create a new project using the Single View Application template called HelloWorld without unit tests or user interface tests.

      As you can see, the top-level node is called HelloWorld, and the two groups below that node are:

      • HelloWorld: Contains the source code for your application.

      • Products: Contains the finished products, created after the source code compiles successfully.

In most cases, you will work with a single project at a time in the Xcode workspace window; however, it is possible to open multiple projects in the project navigator using a workspace file. A workspace file has the file extension .xcworkspace and contains references to one or more project files. You will not be creating workspaces in this book; however, if you were to open a workspace file, the workspace window would display information on multiple projects contained within the workspace (Figure 2.8).

Screenshot of Xcode IDE Project Navigator with three groups, each labeled marked as Project 1, Project 2, and Project 3 respectively.

Figure 2.8

      To create a new group, right-click an existing node in the project navigator and select New Group from the context menu. You can move files between groups by using simple drag-and-drop operations in the project navigator. If the groups in the project navigator correspond to actual folders on your Mac, then moving things around in the project navigator will not move the corresponding files into new locations on your Mac.

      To delete a file, simply select the item and hit the backspace key on your keyboard. Xcode then asks you if you intended to delete the actual file from your Mac or just remove the reference from the project. The process of deleting a group is similar to that of a file; keep in mind that deleting a group deletes any files within that group.

      At the bottom of the project navigator is a set of icons. You can use these icons to filter what is displayed in the project navigator based on certain criteria.

      NOTE

      Note To learn more about the project navigator, read the Project Navigator Help document at http://developer.apple.com/library/ios/#recipes/xcode_help-structure_navigator/_index.html.

      The Symbol Navigator

The symbol navigator (Figure 2.9) shows the classes in your project along with their methods and member variables. A top-level node in a tree-like structure represents each class. Expanding the class node reveals all its member variables and methods.

Screenshot of Xcode IDE Symbol Navigator with the menus Hierarchial and Flat. Hierarchial is highlighted.

Figure 2.9

      The Find Navigator

The find navigator (Figure 2.10) lets you find all occurrences of some text, across all files of the project.

Screenshot of Xcode IDE Find Navigator, with the text delegate in the search bar and search results.

Figure 2.10

      A root-level node in a tree represents each file that has one or more occurrences of matching text. Expanding the node reveals the exact positions within that file where these matches were made.

      The Issue Navigator

The issue navigator (Figure 2.11) lists all compile-time errors and warnings in your project. While compiling a file, Xcode raises an issue each time it finds a problem with the file. Severe show-stopping issues are flagged as errors, whereas less severe issues are flagged as warnings.

Screenshot of Xcode IDE Issue Navigator with the menus By File and By Type. By File is highlighted.

Скачать книгу