Chapter 11. A Whole New World – Developing an App

Until this point, we have been concentrating almost exclusively on learning Swift without learning much about the platforms that it was designed for. This is because learning a new platform is a completely different world from learning a language. Learning a programming language is like learning the basic grammar of a spoken language. The grammar between the spoken languages generally expresses similar concepts but the specific words of the languages are often more varied, even if they are sometimes recognizable. Learning a programming language is learning how to connect the specific vocabulary of your desired platform. This chapter will be about learning some of the vocabulary of the iOS framework.

We will do this by going through the process of starting to develop a simple camera app. Along the way, we will learn some of the most critical vocabularies to get started with any other kind of iOS app and many of the concepts will be transferable to OS X development. More specifically, we will cover:

  • Conceptualizing the app
  • Setting up the app project
  • Configuring the user interface
  • Running the app
  • Temporarily saving a photo
  • Populating our photo grid
  • Refactoring to respect model-view-controller
  • Permanently saving a photo

Conceptualizing the app

Before we even open up Xcode, we should have a good sense of what we plan to develop. We want to know the basics of what kind of data we are going to need to represent and what the user interface is going to be like. We don't yet need pixel perfect designs for every screen, but we should have a good idea of the flow of the app and what features we want to include in our first version.

Features

As we already discussed, we are going to develop a basic camera app. This leaves us with a very clear list of features, which we would want in a first version:

  • Take a photo
  • View gallery of previously taken photos
  • Label photos
  • Delete photos

These are the highly critical features of a camera app. Clearly, we don't have any differentiating features that will make this app valuable above other existing apps, but this will be enough to learn the most critical parts of making an iOS app.

Interface

Now that we have a list of features, we can come up with the basic flow of the app, otherwise referred to as a wireframe. The first screen of our app will be a gallery of any picture the user has already taken. There will be a button on the screen, which will allow them to take a new picture. It will also have the ability to activate the editing mode where they can delete photos or change their label:

Interface

This interface will allow us to take advantage of the built-in picture-taking interface that we will look at in more detail later. This interface will also allow us to make it flexible to work on all the different phone and tablet screens. It may seem simple, but there are many components that have to fit together to make this application work. On the other hand, once you have a good understanding of the different components, it will start to seem simple again.

Data

Now that we know roughly how the app needs to work for the user, we can come up with at least a high-level concept of how the data should be stored. In this case, we simply have a flat list of images with different labels. The easiest way for us to store these files is in the local file system, with each image named after the user chosen label. The only thing to keep in mind with this system is that we will have to find a way to allow two different images with the same exact label. We will solve that problem in more detail when we get around to implementing it.

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

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