In today's mobile-oriented world, iOS development has become one of the most lucrative skills in the tech industry. Many existing companies can benefit from a well-designed app (just look at Starbucks), and mobile apps have created entirely new businesses by disrupting existing industries (such as Uber) or creating new ones (such as Snapchat).
Over the course of this book, we'll be walking through the basics of iOS development by focusing on the Xcode suite of tools, which is the primary software package used to develop iOS (and watchOS, tvOS, and OSX) applications. Along the way, we'll touch upon many subjects, such as the fundamental concepts behind iOS app architecture, the Swift 3 programming language, creating iOS and watchOS applications from scratch, and much more!
The goal of this book is to give you a wide sampling platter of the many different sides to iOS development. By the end, you will have directly touched many unique aspects of app development and will have built your first app from concept to app store!
Welcome to Learning Xcode!
Chapter 1, Starting your iOS Journey, covers the developer's responsibilities, an overview of the Xcode 8 toolset, and an introduction to Model-View-Controller application architecture.
Chapter 2, Welcome to Xcode, looks at the main Xcode application in detail, covering many different areas, modes, and editors.
Chapter 3, Introduction to Swift 3, teaches you the basics of the Swift programming language, from variables and functions to brand new features, such as error handling.
Chapter 4, Using Storyboards, Auto Layout, and Size Classes, covers the visual development side of Xcode, called Interface Builder, in detail.
Chapter 5, Taking Advantage of Source Control in Xcode, gets you up to speed on the concept behind Git version control and how to enable it in Xcode.
Chapter 6, Building your First iOS App, teaches you how to break down an app idea into actionable chunks and then walks you through a full development cycle of app development for an app called Snippets.
Chapter 7, Integrating Multitouch and Gestures, looks at some of the many ways to use advanced touch information in your app through gestures and 3D touch shortcuts.
Chapter 8, Exploring Common iOS Frameworks, covers the concept of code frameworks and then dives into the UIKit, CoreLocation, and Social frameworks.
Chapter 9, Working with CoreData, teaches you the concept behind the CoreData framework and how to use it to save and load user data in an application.
Chapter 10, Creating a watchOS Companion App, looks at how to design and create a companion app for the Apple Watch by using the Snippets app created in Chapter 6.
Chapter 11, Advanced Input Using Sensors, covers the many sensors found in the iPhone using third-party charting frameworks and accessing sensors on Apple Watch.
Chapter 12, Sending Notifications, teaches you how to send the user actionable notifications in addition to displaying application badges and playing alert sounds.
Chapter 13, Writing Unit Tests, introduces the concept of writing code that tests your application code and teaches you how to implement these tests in Xcode.
Chapter 14, Debugging an iOS Application, covers the different ways to search for and eliminate bugs in your application code.
Chapter 15, Optimizing your App, gives you an overview of the tools in Xcode that help speed up the performance of your code and reduce the file size of your app's resources.
Chapter 16, Distributing an iOS App, walks you through the process of taking a finished app from Xcode to the App Store.
In order to follow along with this book, you'll need a computer running Mac OS X 10.10 or later with Xcode 8 installed (free on the Mac App Store). In Chapter 5, we will also be using GitHub Desktop, which is a free download from the https://github.com/ website.
To get the most out of the book, you'll also need a recent iOS device (iPhone 6S or newer for the 3D touch segments) and a lightning cable to connect it to your computer. In the final chapter, you will need a paid ($99) Apple Developer Account to follow along with submitting an app to TestFlight and the App Store.
Learning Xcode 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.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include
directive".
A block of code is set as follows:
struct SnippetData { init() { print ("new snippet created") } }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
func textViewDidEndEditing(textView: UITextView) {
saveText(text: textView.text)
dismissViewControllerAnimated(true, completion: nil)
}
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: " At the bottom of the window, you should see a drop-down menu for Command Line Tools."
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>
, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the SUPPORT tab at the top.
Click on Code Downloads & Errata.
Enter the name of the book in the Search box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on Code Download.
You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learning-Xcode-8. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from www.packtpub.com/sites/default/files/downloads/LearningXcode8 _ColorImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>
, and we will do our best to address the problem.