Setting up the app project

Now that we have finished conceptualizing our app, we are ready to start coding. In Chapter 3, One Piece at a Time – Types, Scopes, and Projects, we created a command-line project. This time, we are going to create an iOS Application. Once again, in Xcode, navigate to File | New | Project…. When a window appears, select the Single View Application from the iOS | Application menu:

Setting up the app project

From there, click on Next and then give the project the name LearningCamera. Any Organization Name and Identifier are fine. Finally, make sure that Swift is selected from the Language drop down menu and Universal is selected from the Devices drop down. Now select Next again and create the project.

Xcode will then present you with a project development window that looks somewhat different from a command-line project:

Setting up the app project

This default screen allows us to configure various attributes of the app including the version number, target devices, and much more. For our purposes, all of the defaults are fine. When you decide to submit an app to the app store, this screen will become much more important.

Xcode has also created a few different files and folders for us. We will be working exclusively in the LearningCamera folder. The LearningCameraTests folder is for automated tests; they are a fantastic idea but beyond the scope of this book. The final folder is the Products folder, which you won't have to change.

In the LearningCamera folder, we have several important files. The first file is AppDelegate.swift, which is the entry point of the application. It has a class that was created for you, called AppDelegate that has a number of methods that are called at different points during the application life cycle. We won't have to modify this file for our purposes but it is an important file in many applications.

The second file is ViewController.swift. This holds a UIViewController subclass that is used to manage the interaction between the app's default view and the business logic. We will be doing a lot of work in there.

The third file is Main.storyboard. This file contains the interface design for our views. Currently, it has only a single view that is managed by ViewController. We will be working with this file later to add and configure our visual components.

The fourth file is Assets.xcassets. This is a container for all of the images that we would want to display in our app. Almost every app you make will have at least one image so this is a very important file too.

Finally, the last file is LaunchScreen.storyboard. This file lets us manage the display while our app is launching. This is an extremely important part of a production application because this is the first thing a user sees every time they launch it; a well-designed launch process can make a huge difference. However, we do not have to do anything to this file for our learning purpose.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset