Book Image

Learning Xcode 8

By : Jak Tiano
Book Image

Learning Xcode 8

By: Jak Tiano

Overview of this book

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.
Table of Contents (23 chapters)
Learning Xcode 8
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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:

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:

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:

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:

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.