Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning Xcode 8
Learning Xcode 8

Learning Xcode 8: Learn to build iOS Applications with Xcode 8

eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Learning Xcode 8

Chapter 1. Starting Your iOS Journey

When Steve Jobs announced the original iPhone in January of 2007, he referred to it as a combination of three product categories: a widescreen iPod with touch controls, a revolutionary mobile phone, and a breakthrough Internet communications device. When he first announced each of those three feature sets on stage, the iPod and the phone received tremendous applause from the crowd. However, the Internet communications aspect only got a few polite claps. In 2007, the iPhone ran on EDGE (2G) cellular networks. There was no iCloud. The App Store wouldn't exist for over a year; iPhone OS was a closed platform. At the time, there just wasn't anything particularly exciting about an internet communicator.

Fast-forward to the present day: our phones are running the 10th version of iOS, and each year iOS developers are getting paid over $10 B from app sales and in-app-purchases. Since the days of the original iPhone, we've seen the introduction of the iPod Touch, the iPad Air, iPad Mini, and iPad Pro, and in the last year or so the Apple Watch and Apple TV as well. . If it hasn't been made clear yet, the iOS ecosystem's growth has been explosive! While this is nothing but excitement for iOS users, for someone who is about to set off on their journey as an iOS developer, all of these facts just mean that there is much more to learn!

While the iPod and the mobile phone pieces of Steve's original iPhone pitch are still there, the defining aspect of the iOS success story is its internet communicator capabilities, which you are about to dive into with iOS app development using Xcode. In this first chapter, my goal is to make sure you are informed, prepared, and excited to begin developing for the iOS platform. We'll be covering a wide variety of topics, including:

  • A developer's responsibilities
  • Working on a team
  • An overview of the Xcode 8 suite of tools
  • Understanding the Model-View-Controller paradigm
  • Signing up for an Apple Developer Account

So without any further delay, let's go!

A developer's responsibilities

Before we get into anything too technical, let's go into a little detail about what an iOS developer does. It's obvious that we'll be doing a lot of coding, but that's not the whole story! As a developer, you might be responsible for many different technical aspects of a project depending on the team structure, which we'll get into shortly. But for now, we'll take a look at the general items that end up on a developer's to-do list.

Note

As we walk through the next few sections, don't be alarmed if you find yourself a little lost. Everything discussed here is explored in much more detail in this book, but for now we're going to jump right in and learn through immersion. By introducing you to terms in a meaningful context, you should hopefully have a good idea of how they relate to each other before we explore them individually.

Pre-production

Every project starts with an idea; that's the easy part. Unfortunately, you're not the idea person, but the one in charge of execution. In the pre-production phase of a project, your responsibilities are to take an idea and translate it from wishful thinking into a plan of action.

The first thing that usually happens after brainstorming is that you'll write out a list of features that the application will have. Using your programmer's point of view, you want to break down the idea into all of the technical components that you can.

As you become more experienced it will become easier to know what to plan for, but as a general rule of thumb you will only want to focus on the core features of your app here. What features are needed for a minimum viable product? Again, experience here will help you figure out how deep you should go into your plan, but once you have a good idea of what you will be doing, it's time to move ahead.

Project setup

Now, before you can even write one line of code, you first have to set up your development environment. For most projects, this means creating a new Xcode project and setting up your preferred method of source control.

When setting up a new project, it's important to refer back to the technical plan you made during pre-production to help inform your decisions. Are you going to be using any of the Xcode project templates? Where will your repository be located? Is there anyone else on the team that needs access to the source code? Does the app need any services enabled? Are there pre-existing code libraries that you need to import for your project?

It will be your job to make sure that Xcode and any other necessary tools are configured properly and optimized for the job ahead. Once you've got all of the setup out of the way, it's finally time to start writing some code!

Development

When the application is in active development, it is your time to shine. In this phase you'll be having the most fun, but you'll also have the most responsibilities.

When developing an application, you'll be writing code to handle both the data model and the user interface of the program. You'll also be using storyboards in Xcode to layout the screens of an application. A lot of your time will be spent with these two tasks to create new view controllers that add or change features in your app.

In addition to building the software, you will need to do routine project maintenance. This means that you should be frequently checking in with source control and reviewing other programmers' code additions. You will also be writing unit tests to make sure your code is functioning as expected. On top of all of that, you will be debugging and optimizing your code.

While development can take weeks, months, even years to get to a finished state, the market can't wait that long! Usually, once your app has all of its core features implemented and tested, you will polish it up and release it to the world to get feedback.

Deployment

When a new feature is complete, or when a predetermined milestone is hit in a project, you need to then get your app into the hands of people who actually want to use it!

For you, this means several things. First, you'll want to create a release build of the application that removes any debug features that an end-user doesn't need. Then you'll be responsible for packaging that build up and putting it somewhere that others can access it; if you're still beta testing, a platform like TestFlight might make sense, or if you have a finished, tested build, it's time to get ready for the App Store.

Working on a team

In the previous section, we started to touch on what a developer can be expected to do over the length of a project. More importantly, though, we should also be able to see how even with all of those responsibilities there are still many things unaccounted for! Who is designing the layout of the screens we are building? Who is creating the assets that we will be using in our app? Who is keeping everything on schedule?

While we will be taking a lone wolf approach to development as we learn throughout this book, the real world of software development doesn't work that way. As a developer, you are just one of many roles on a team. Depending on the size of the team, you may even be splitting the technical responsibilities among several other people. Let's take a look at the other project roles you may interact with while making an app.

Note

Remember: every team is different! You may never encounter a team in your career where the roles resemble the descriptions below. (But I highly doubt that!)

Designers

If you think of the developer as the person who deals with the How of a project, the designer is the person who actually determines the What. Designers are responsible for developing what the application looks like, and the content that is inside of it. They will often approach problems from both a psychological and aesthetic point of view, trying to tie the two together to create an experience that is seamless and intuitive.

When working with a designer, communication is key. You are both trying to solve the same problems, but from very different angles; it is common to not understand where the other person is coming from. But remember, the success of the project depends on your cooperation. Taking a moment to explain a technical limitation (or to listen to feedback about your implementation of their design) will not only help avoid similar problems in the future, but will also promote trust within the team.

Other programmers

In addition to designers, the other role you will be spending the most time with is… more programmers. While some small projects can get by with a single programmer, it is much more likely that you'll be working with at least a few other programmers. With multiple programmers on one team, you'll be split up in all kinds of ways. Sometimes you will be evenly split between different major features. Other times each developer might be in charge of different tasks (build master, unit tests, etc.). It all depends on the needs of the project and the size of the team.

While there won't be as much of an understanding barrier between other coders as there might be with designers, there are still plenty of issues that can arise from working with other developers. It is common for every programmer to have his or her own unique style of coding, but when working on a team it is important to have at least some ground rules so that everybody can understand everyone else's code.

Sometimes, you will also be working with developers who might not be as experienced in a topic as you are (or maybe you will be the inexperienced one!). In those cases, it's still important to be patient and help those people understand what's going on. Teams thrive on trust, and you never know what that person might be able to teach you down the line.

Project managers

A project manager's job is pretty self-explanatory. They need to make sure that everyone on the team is making progress towards whatever goal has been set. Perhaps more than any other role, the project manager can come in many different shapes and sizes. Every company, every team, every project even will approach the management of a project differently.

Many teams these days use some form of agile development, but the implementation varies greatly. Generally, the goal of an agile team is to work in short bursts called sprints that last for a week or two. During each sprint you'll be working on only a handful of tasks, with the intention of lightweight and rapid iteration.

On these kinds of teams, the project manager might be a dedicated person, or even a hierarchy of individuals responsible for leading small feature teams. Whatever arrangement you find yourself in, it's important to work with your project manager (or project management software) to make sure that your progress is being tracked properly.

Investors

An investor is one of the people (or perhaps the only person) who has a financial stake in your project. Investors could range from parents, to clients, to venture capitalists. The important thing is that they have put up some amount of cash to fund the project, and are most likely expecting to get a return on that investment.

Depending on your seniority in a team, or the type of project you're working on, you may or may not ever have to deal directly with an investor. While every investor you have to deal with is guaranteed to be very different from the last, it's always important to treat them with respect and honesty (unless the honesty will compromise the respect!). Remember, they're the ones putting food on your table.

The Xcode 8 toolset

At this point, we've taken a pretty good look at a lot of the general things that an iOS developer does during a project, and how they work with a team. So, with all of that out of the way, let's take a tour of the main event: Xcode 8 (and friends!).

We'll be taking a much deeper look at Xcode in the next chapter (Chapter 2, Welcome to Xcode), so we'll mostly be skimming through the big pieces here to get an understanding of how they all fit together.

Xcode

Xcode is Apple's full IDE (integrated development environment) for building software for any Apple platform. First used for Mac OS X development, then expanded for iOS, watchOS, and tvOS, if you're making apps for Apple hardware you're using Xcode. Luckily, it's chock full of features, easy to use, and looks great:

Xcode

Figure 1.1: The main Xcode application window

Xcode has several primary features. As an IDE, it uses a custom .xcodeproj file format to manage all of the code, asset, and configuration files that you create and import. It also has a fully-featured source code editor that is optimized for Objective-C and Swift languages, including file presets made for macOS/iOS development, and built-in documentation viewing. Finally, Xcode compiles your code and makes it easy to deploy the resulting packages to simulators, test devices, and even the App Store.

There's no reason to go any deeper than that for now, since the rest of this book is about doing exactly that. However, I would like to introduce you to some other major tools that are hidden within the Xcode application that you will be seeing again later.

Note

If you'd like to actually see where these tools reside for yourself, first navigate to the Xcode.app (most likely in your Applications folder). Then right-click on the icon and select Show Package Contents. Then, navigate to Contents | Applications, and Contents | Developer | Applications to see the hidden apps we are about to explore. And don't worry! We'll have much easier access to them from within Xcode, so there's no need to remember how to find them like this.

iOS and watchOS simulator

The iOS and watchOS simulators are small applets that make it easy to test the applications you make without needing a dedicated testing device. With the variety of screen sizes now available on iOS devices, the chances are slim that you will own one of every size to test on; luckily, the simulators make it easy to check your app's layout on every screen size:

iOS and watchOS simulator

Figure 1.2: The iOS and watchOS simulator windows

The Apple watch is also a relatively new product. Leading up to its launch (and shortly after), limited availability of Apple Watches made it near impossible to get a hold of one for testing. Even now, it isn't nearly as ubiquitous as an iPhone, and not every developer has access to a real device. Finally, sometimes your devices are preoccupied, and you just need to test some code!

Note

Prior to Xcode 7, to test an app on a real device required a paid Apple developer license. For many students or hobby developers, the simulator was their only way of running the apps they made without paying for the full license. In 2015, however, Apple revamped the way their developer accounts work, and building to your device no longer requires a paid account.

Instruments

When creating an app, you spend most of your time dealing with high-level concepts, like the sequential logic of a function, or the layout of a screen. At some point, though, it is important to get a better understanding of how your app works under the hood:

Instruments

Figure 1.3: The Instruments application's template chooser

Instruments is an analysis and profiling tool that can help you do just that. It is made to help you understand how your application's processes are running on the CPU to help you reproduce hard to find logic errors, patch memory leaks, and stress test different parts of your app.

Application Loader

Application Loader is a small application that ships with Xcode with the sole purpose of uploading data to the App Store servers. In the standard workflow of iOS development, managing the App Store side of things can usually be taken care of with iTunes Connect in conjunction with Xcode directly:

Application Loader

Figure 1.4: The Application Loader template chooser

However, some people prefer to use Application Loader to upload app binaries and in-app-purchase content. Essentially, they accomplish the same tasks, but Application Loader tends to be a bit clearer.

Understanding Model-View-Controller (MVC)

Developing any type of software requires logical thinking and strong problem-solving skills. However, programmers have been building software for decades, and have collectively encountered and solved a great number of the common problems encountered when writing code.

As time has passed, some of the best solutions to common problems that have been developed and shared are in the form of patterns. On a granular level, there are design patterns that are used to solve common problems at the object or multi-object level. As an example, the Singleton pattern describes a class that may only have one instance, with a global access point. Since it isn't a specific set of instructions for any given language (remember, it's just a pattern), the Singleton pattern can be implemented in many different languages, as is the case with most design patterns.

In addition to solving smaller issues with design patterns, programmers have also developed many patterns concerned with outlining how an entire program should be structured; these are called architectural patterns. At the core of Cocoa Touch, Apple's native API for building apps for iOS, is the architectural pattern called Model-View-Controller.

Understanding Model-View-Controller (MVC)

Figure 1.5: The Model-View-Controller architectural pattern

The pattern is pretty simple to understand: the code of an MVC program is separated into a data layer (the model), a user presentation layer (the view), and a third layer that connects the two halves (the controller). This allows for a very logical separation of functionality in your code.

Note

Cocoa Touch is based on the original Cocoa, which is the API that Apple built for programming OSX apps. There is a very fascinating history behind Smalltalk, Objective-C, NeXTSTEP, and how all of that led to OSX and ultimately iOS. Since it won't be covered in this book, I hope you will research and understand these technologies that led to the modern iOS development environment.

Since it is foundational to the underlying technology of Apple's development frameworks, using MVC when building your applications is pretty much mandatory, and enforced at every turn. As we explore Xcode and Swift, you'll see the idea of MVC everywhere: CoreData is how you can design your model; Storyboards are quite literally where you create views; UIKit has many types of built in view controllers. In time, we'll cover all of these individually and in depth, but for now let's make sure we have a firm grasp on the basics of Model-View-Controller.

Model

At the very core of an application is its data. In a music app, that would be the music files and associated metadata. In a contacts app, it would be a database of your saved contacts. In Twitter, it's the tweets. You get the idea. The model of an application is all about how you represent and manipulate that persistent data.

Let's use the contacts app as an example, and assume that the database of contacts is stored locally on your device. The model for that data would need to do several things. There needs to be a way to load contact information from the database into an object in code. There should also be ways to modify and save that data, for times when a user might want to change a contact's information, or add a new contact altogether. Finally, the model needs to be able to tell a controller when any of the contact data has changed:

Model

Figure 1.6: How the model functions and interacts with a controller

While the first capability (having a container to load data into) is an internal feature of the model, the other two capabilities are essential exposures needed for the model to communicate with the controller. The controller will be capable of sending updated information to the model, which needs to be able to receive that data, format it correctly, and save it back to the database. Likewise, the model needs to let the controller know when its data has changed, so that the controller can react accordingly.

This creates a clean, separated relationship; the controller sends simple data to the model and handles general update events, while the model takes care of all the saving, loading, manipulation, and formatting.

View

While the model is taking care of the raw data, the view is in charge of what is actually being seen by the user. Continuing the example of a contact management app, let's take a look at how the view might be handled:

View

Figure 1.7: The view of a contacts app, shown interacting with a controller

Here, we can see that the view is showing the user some nicely formatted contacts. On the left is a round portrait of the person, followed by their name, and less important on the right is a greyed out word that signifies if the contact is for that person's home or work information. You can also see that the controller is sending the view the information to display, and that the view is relaying any user input back to the controller.

What's powerful about decoupling your view from all of the other application logic is that you can rapidly iterate how your app looks and feels, without having to worry about breaking any of the important logic underneath. It also keeps the amount of data needed in your model to a minimum. For example, our model has no idea that the portrait image will be cropped to a circle, or what size the font needs to be on a contact's name. The view keeps track of everything related to presentation, often in a way that is highly reusable.

Controller

We've seen how the controller works independently with both the model and the view and we've got a pretty good idea of how everything works together, but let's look at a little bit more of a detailed big picture to really see what the controller is doing:

Controller

Figure 1.8: How the controller ties everything together

Looking inside the controller, you can see that we've elaborated a bit on what's going on. You'll notice that the controller is capable of receiving notifications from both the model and the view, and then make decisions based on those notifications. It is also capable of sending updated information back to the model and the view.

Note

As you'll see later in the book, a controller can (and often does) do a lot more than just listen for changes. It is also responsible for setup tasks, supplementary logic, and pretty much anything else that doesn't fit in the model or view.

This cycle repeats for the duration of the controller's existence. Listen for changes. Process notifications. Update appropriate objects. Listen for changes. Process notifications. Update appropriate objects. It's a very elegant solution that keeps your code decoupled while still making it easy for changes on both sides to be properly dealt with throughout the application.

However, this diagram shows a very generic representation of controller logic. Often when developing an app, you'll write many unique controllers that all need custom logic, and each handle things a little differently. At each controller's core though, you'll find that they all need to implement this functionality in some way.

MVC on the web

Now, we've spent some quality time with the theory of the Model-View-Controller software architectural pattern, but I find the best way to learn is through examples. So let's take a quick look at how MVC is used on an Internet browser, something most people use every single day:

MVC on the web

Figure 1.9: HTML is used to define the "model" of a web page

One of the most interesting parts of how the web works is that it has several different languages, and each one handles a different function. HTML is a markup language that defines the content of a web page. This means that HTML defines our model. There usually shouldn't be any formatting in an HTML file, so viewing one directly will be an unformatted jumble of source text and images. In Figure 1.9, you can see how the HTML document contains the data for the website title, along with images and captions:

MVC on the web

Figure 1.10: The CSS files define the formatting of a web page

Separate from HTML is a style sheet language called CSS. CSS knows nothing about the data in your HTML files, and is only responsible for defining the visual rules for how HTML elements will be displayed. It determines things like the height and widths of different elements, color information, and rules for how text should be displayed. This would make CSS in charge of our view. In Figure 1.10, you can see how the CSS file results in a basic layout of a web page, such as position and size information. However, all of the content is blank, to reinforce that it does not know anything about the content that will be displayed:

MVC on the web

Figure 1.11: The browser is the controller, and uses JavaScript to implement additional logic

Finally, we have the browser itself, which loads both the HTML data and the CSS rules to give us the final rendered page. The browser uses a third language, JavaScript, to dictate its behavior. It can receive input events like clicks and key-presses, and listens for changes in the model. It can then respond to these events with JavaScript callbacks. Our browser is our controller.

Note

If you're well versed in coding the web, you'll know that there is a lot more than this going on behind the scenes. There are many other languages and technologies that keep the modern web afloat, but we're simplifying it for educational purposes.

Hopefully, looking at MVC through a piece of software you are already familiar with has given you a stronger grasp of these concepts, in addition to giving you a bit of insight into how the web works! Now let's jump back to iOS and put everything together.

MVC on iOS

As I alluded to earlier, Xcode and the entire iOS toolset and APIs are built around the concepts of Model-View-Controller. I'd like to point out a few of the more obvious ways in which the concepts are enforced, but as you read through the book and eventually go out to explore and learn on your own, keep an eye out for all of the ways that MVC is present:

MVC on iOS

Figure 1.12: A sneak peek at the CoreData model editor in Xcode 8

As we've been doing, let's start with the model. Usually when working on an iOS application, your goal is to represent some kind of data. Sometimes it is a small amount of simple data, like in a weather application, and you can just retrieve it from the web on demand each time you load the app. Other times, you'll be storing and processing large amounts of data, usually in some type of database.

The simple cases don't require too much thought, but there are some great features in Swift that we'll cover in Chapter 3, Introduction to Swift 3, that make simple models easy to code, and easy to use.

For the more complex scenarios, there is CoreData, which is essentially an Apple-developed solution for building data models. CoreData is built into iOS, and a visual CoreData model editor is built right into Xcode (see Figure 1.12). This means that implementing a complex data model is fast, easy, and native to the development environment. We'll talk more about CoreData in Chapter 9, Working with Core Data:

MVC on iOS

Figure 1.13: Interface builder lets us create the views for iOS apps

Next, let's talk about views. When we talked about a web browser in the last example, we looked at how CSS dictates the appearance of a web page. On iOS, there's an even better way to build out our visual layouts: Interface Builder (see Figure 1.13). As the name implies, Interface Builder allows us to directly drag and drop UI elements in a visual What-You-See-Is-What-You-Get (WYSIWYG) editor. We can move things around, set different properties, and then even set constraints that allow us to dictate how they should look when the screen changes orientation, or when displayed on different screen sizes. This means that building views is done in a way that makes the most sense: visually. We'll be covering Interface Builder in Chapter 4, Using Storyboards, Auto Layout, and Size Classes.

So now we've discussed how to build models and views for iOS apps, and we haven't even talked about coding yet! That's a bit of a lie though, since there is a little more programming than was mentioned in the model section, but still! If we think about how MVC works, though, this should make sense. Models and views are mostly things that need to be defined; all of the action happens in the controller.

On iOS, controllers are usually implemented by creating a sub-class of a UIViewController, a class built into the UIKit framework. We could talk about UIViewControllers for hours (and in fact, we will throughout the rest of the book), so for now just know that this is where you will be doing a good chunk of your coding: handling input events, updating the views, and running supplementary logic.

Becoming a registered developer

Before we can get full access to all of the tools we'll need throughout the book, we're going to have to enroll in the Apple developer program. There are two options we can choose here: we can sign up with a free account, or we can pay the $99/year fee to become a fully licensed Apple developer.

Which account do you need?

The free account will be good for those just starting out, as it provides access to a handful of important features. You have full access to the Xcode developer tools, in addition to beta releases of new versions of Xcode. You'll also have access to the developer forums, where you can chat with other developers about issues you might be facing. Most importantly, however, is that you can test your apps on a real device.

The $99 account gives you everything else. This includes access to betas of new versions of iOS, all of the app services that Apple provides (iCloud, Game Center, and so on), and of course the ability to publish your app to both TestFlight and the App Store.

For most of this book, you will be able to get by just using a free account. However, there will be some parts of chapters (in addition to the entire chapter about distribution) where you will need a paid account to be able to follow along. So, let's get you set up with this one last thing before we embark on our journey!

Registering a free developer account

Signing up for a free developer account couldn't be simpler. First, make sure you have an Apple ID. If you already have an iCloud or iTunes account, you probably already have one. If you'd like to create a separate Apple ID for development, you can do that at https://appleid.apple.com/, although it isn't really necessary.

Once you have determined what Apple ID you want to use for your developer account, head over to http://developer.apple.com/membercenter, and log in with those Apple ID credentials. You should end up on the following screen:

Registering a free developer account

Figure 1.14: The iOS developer member center home page

If so, you're done! In the next chapter, we'll be covering everything you need to know about getting your account set up with Xcode.

Registering a paid developer account

Registering a paid developer account is quite a bit more tedious. When you sign up for a paid account, there are legal and financial formalities involved since you will be able to sign contracts and sell digital products on the App Store worldwide.

To begin the process, start from where the previous section left off. Make sure your Apple ID is set up properly, and log in at http://developer.apple.com/membercenter. Once you've done that, click on the Join the Apple Developer Program area at the bottom of the page (the arrow in Figure 1.14), and then the Enroll button in the upper-right corner on the next page.

Follow the instructions and fill out the information that it asks for throughout the signup process. Finally, you'll have to pay the $99 fee, and submit your application. The application usually has to go through a review period before you are approved.

Once you're approved, congratulations! You're now officially licensed to create and sell iOS, watchOS, and even Mac OS X apps on all of Apple's App Stores! All you have left to learn is… everything else.

Summary

Whew! Take a deep breath, because that was a lot of information. We touched on many different subjects, but hopefully you are now in the right mindset to begin your journey. Let's do a quick review of everything we learned in this chapter. First, we discussed a developer's responsibilities throughout a normal product lifecycle. Next, we outlined how a team might look, and how a developer would interact with the different roles. Perhaps one of the most important topics that we covered in this chapter is the Model-View-Controller architectural pattern for building software. Lastly, we looked at setting up an Apple Developer Account.

In the next chapter, we'll be taking a much deeper look into Xcode. You've already seen and read about bits and pieces of Xcode, but now we'll be walking through all of the major features, and getting a feel for navigating through the program. As we're exploring, keep in mind the topics of this chapter, especially MVC, and see if you can figure out how they manifest throughout Xcode.

Onwards!

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn the theory and tools behind app development using Swift 3 and Xcode 8
  • Build a fully featured iOS app, including a companion app for the Apple Watch
  • Optimize, debug, and ultimately release your app on Test Flight and the App Store

Description

Over the last few years, we’ve seen a breakthrough in mobile computing and the birth of world-changing mobile apps. With a reputation as one of the most user-centric and developer-friendly platforms, iOS is the best place to launch your next great app idea. As the official tool to create iOS applications, Xcode is chock full of features aimed at making a developer’s job easier, faster, and more fun. This book will take you from complete novice to a published app developer, and covers every step in between. You’ll learn the basics of iOS application development by taking a guided tour through the Xcode software and Swift programming language, before putting that knowledge to use by building your first app called “Snippets.” Over the course of the book, you will continue to explore the many facets of iOS development in Xcode by adding new features to your app, integrating gestures and sensors, and even creating an Apple Watch companion app. You’ll also learn how to use the debugging tools, write unit tests, and optimize and distribute your app. By the time you make it to the end of this book, you will have successfully built and published your first iOS application.

Who is this book for?

This book is intended for programmers looking to get a jump-start into the world of iOS development. Whether you’re a young student who has only spent a few months with Java, or a seasoned developer who has spent their career developing for a different platform, all that is expected is a basic understanding of a programming language such as C++, C#, or Java.

What you will learn

  • Understand the most important features of the Xcode IDE
  • Write Swift 3 code for application data models and view controllers
  • Prepare visual layouts for an iOS application using storyboards, size classes, and auto-layout
  • Integrate many common technologies into an app, such as multi-touch gestures, CoreData, and notifications
  • Build companion applications for the Apple Watch with watchOS 3
  • Debug applications using Xcode's suite of debugging tools, and prevent bugs with unit testing
  • Optimize an application using Xcode 8's profiling tools and asset catalogs
  • Distribute a beta application through TestFlight, and a finished application through the App Store
Estimated delivery fee Deliver to Cyprus

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 18, 2016
Length: 480 pages
Edition : 1st
Language : English
ISBN-13 : 9781785885723
Vendor :
Apple
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Estimated delivery fee Deliver to Cyprus

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

Publication date : Nov 18, 2016
Length: 480 pages
Edition : 1st
Language : English
ISBN-13 : 9781785885723
Vendor :
Apple
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 111.97
Mastering Swift 3
€36.99
Learning Xcode 8
€41.99
Swift Data Structure and Algorithms
€32.99
Total 111.97 Stars icon

Table of Contents

17 Chapters
1. Starting Your iOS Journey Chevron down icon Chevron up icon
2. Welcome to Xcode Chevron down icon Chevron up icon
3. Introduction to Swift 3 Chevron down icon Chevron up icon
4. Using Storyboards, Auto Layout, and Size Classes Chevron down icon Chevron up icon
5. Taking Advantage of Source Control in Xcode Chevron down icon Chevron up icon
6. Building Your First iOS App Chevron down icon Chevron up icon
7. Integrating Multitouch and Gestures Chevron down icon Chevron up icon
8. Exploring Common iOS Frameworks Chevron down icon Chevron up icon
9. Working with Core Data Chevron down icon Chevron up icon
10. Creating a watchOS Companion App Chevron down icon Chevron up icon
11. Advanced Input Using Sensors Chevron down icon Chevron up icon
12. Sending Notifications Chevron down icon Chevron up icon
13. Writing Unit Tests Chevron down icon Chevron up icon
14. Debugging an iOS Application Chevron down icon Chevron up icon
15. Optimizing Your App Chevron down icon Chevron up icon
16. Distributing an iOS App Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(3 Ratings)
5 star 66.7%
4 star 0%
3 star 33.3%
2 star 0%
1 star 0%
Michael Briscoe Jan 25, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is one of the best instructional books I’ve read. My only problem with it is that it is geared specifically to iPhone app development and I’m not interested in that, I am learning Swift for Mac development. Most of the skills transfer over, but would like to have a book that specifically addresses Mac development.
Amazon Verified review Amazon
O. M. Aszkenasy Apr 16, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is the best book about learning Xode 8 that I have read. The author has a highly engaging and enthusiastic style. He provides a thorough introduction to the Model-View-Controller principle (something that I struggled with until now) and then leads you through the complexity of the Xcode interface, something that other books only touch on. Then there's a great chapter on how to build a simple 'hello world' application and explains in detail how it works. Next we start to learn how to programme in Swift. That's how far I've so I will update once I have finished the book. However, I just wanted to get this down as I am so excited to find a book about Xcode that makes it fun and easier to understand this amazing programming environment.
Amazon Verified review Amazon
Hal Dale Feb 14, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Pretty good.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela