Skip to main content
main-content
Top

About this book

Get up and running with Apple's latest version of Xcode, and see how to use Swift in Xcode to build a variety of projects.

If you already have some programming experience with iOS SDK and Objective-C, but want a more in-depth tutorial on Xcode, especially Xcode with Apple’s new programming language, Swift, then Beginning Xcode: Swift Edition is for you.

The book focuses on the new technologies, tools and features that Apple has bundled into the new Xcode 8, to complement the latest iOS 10. By the end of this book, you'll have all of the skills and a variety of examples to draft from to get your Swift app from idea to App Store with all the power of Xcode.

What You’ll learn

Use Swift and new Swift-related features in Xcode

Get started with Xcode, using Workspaces, Interface Builder, storyboarding, tables/collection views and moreTake advantage of Xcode's vast libraries, frameworks and bundles

Create exciting interactive apps for iPhone or iPad using Sprite Kit, Map Kit, and other Apple technologies

Share your app using organizer, localization, auto layout, and more

Who this book is for

Those with some Objective-C/Cocoa and/or iOS SDK app development experience, but want to be more efficient in writing and testing their code, and people who want to know in-depth examples of Swift in Xcode.

Table of Contents

Getting Acquainted

Frontmatter

Chapter 1. Welcome to Xcode

Abstract
Apple provides Xcode to developers to help them create applications for Macs, iPhones, and iPads (macOS and iOS). Xcode was used to create many of your favorite iOS and macOS applications. Arguably, without such a powerful, refined, integrated development environment (IDE), the thriving ecosystem that is the App Store would not exist as it does today.
Matthew Knott

Chapter 2. Diving Right In

Abstract
In Chapter 1, you downloaded Xcode, made sure it was correctly configured, signed up for a developer account, and explored the wealth of resources provided by Apple to help you get started with not only Xcode but also some of its fantastic new technologies. This chapter explains how to create a working application using Xcode’s visual interface building tool (aptly named Interface Builder) and its built-in code editor and then run the app on your machine.
Matthew Knott

Chapter 3. Project Templates and Getting Around

Abstract
In order to be an accomplished app developer, it’s important that you train your developer’s muscle memory around the key areas of your IDE; there’s a good chance you already knew this, which is why you bought this book. By the end of this chapter, you should be a lot more familiar with many of the interface elements of Xcode, should be able to quickly access the most common Xcode features, and should have a great knowledge of the more obscure ones. You should also be able to choose a project template without having to worry about whether you’ve picked the right one, and you’ll have some of the key knowledge required to start creating your own applications.
Matthew Knott

Chapter 4. Building Interfaces

Abstract
A lot was covered in Chapter 3: You looked at each of Xcode’s default iOS project templates, examined when exactly you should use them, and then took a tour of the main areas of Xcode’s workspace. And if that wasn’t enough, you created an application with multiple views that could share information between the views.
Matthew Knott

Chapter 5. Getting Help and Code Completion

Abstract
In Chapter 4, you accomplished quite a lot. You should be starting to feel more confident with the tools and features available in Xcode, and hopefully you’re seeing how it can help you build your own applications.
Matthew Knott

Chapter 6. Constraints

Abstract
This chapter introduces you to a feature of Xcode that is still relatively new and has been over the last few versions of Xcode: the Auto Layout system. Auto Layout (or Autolayout, as Apple sometimes refers to it) had its last significant revision in Xcode 6 with the addition of size classes to allow for more adaptable storyboards, the subject of the next chapter. In this chapter, you use Auto Layout to build an example application that adapts to changing resolutions and screen orientations the way you want it to. What’s great is that the techniques you learn here are largely applicable to both iOS and OS X development.
Matthew Knott

Diving Deeper

Frontmatter

Chapter 7. Storyboards

Abstract
Chapter 6 for the most part took a break from writing code to look in detail at Auto Layout, Xcode’s system for arranging layouts and specifying how they react to changes in form factor or orientation. It also explained how to craft a tailor-made user experience by customizing keyboards and text fields.
Matthew Knott

Chapter 8. Table and Collection Views

Abstract
In this age of big data, it seems in every facet of our lives we’re being bombarded by more and more data, and as developers, we often find ourselves needing a way to display large amounts of data to users in a concise and structured manner. In iOS, Apple has provided the table view and collection view for this purpose.
Matthew Knott

Chapter 9. Frameworks, Libraries, and Targets

Abstract
In Chapter 8, you learned about how to configure and implement table and collection views as you completed a Twitter client, SocialApp. You also used two frameworks, Social and Accounts, to access the Twitter API; frameworks are a topic I explain in more detail in this chapter. You also parsed the JSON-formatted data and looked at NSDictionaries in action. The chapter covered many important aspects of Xcode application development, and I hope you found the project useful and enjoyable—maybe even a bit exciting!
Matthew Knott

Chapter 10. Advanced Editing

Abstract
I explain how small bits of reusable code can be saved as snippets, readily available to be dropped into your application, as well as look at the many ways you can customize Xcode to work for you. It’s a cliché, but everyone is different, and developers are no exception.
Matthew Knott

Chapter 11. Debugging and Analysis

Abstract
This leads nicely into this chapter, where you learn about debugging and analysis and, hopefully, answer the question, “How can Xcode help when the bugs start raining down?” Xcode has a whole suite of tools dedicated to making your life easier when it comes to determining why your code throws an exception or why in some cases nothing happens at all. This chapter takes a detailed look at all of these reasons. Additionally, I discuss some of the lesser-known debugging tools that aren’t integrated into Xcode but are essential as you explore the breadth of the features of iOS application development with Xcode.
Matthew Knott

Final Preparations and Releasing

Frontmatter

Chapter 12. Version Control with Git

Abstract
The focus of this chapter is version control, and specifically how Xcode integrates with the Git source code management system. Xcode stands out from other IDEs in this department. Its integration is so fine and complete that it’s a joy to use and so intuitive you’ll wonder why you haven’t used it before.
Matthew Knott

Chapter 13. Localization

Abstract
Chapter 12 looked at how Xcode uses Git to create some of the finest version control ever seen in an IDE. You created a simple voice recorder under Git source control, branched the repository to add extra functionality without altering the original, and then merged the two branches together.
Matthew Knott

Chapter 14. Devices and the Organizer

Abstract
Chapter 13 taught you about localization and how you can enable your application to appear in multiple languages with minimal effort. To learn about localization, you built the SayMyName application, where you used the ContactsUI framework to pick a contact and the AVFoundation framework to say it.
Matthew Knott

Chapter 15. Building, Sharing, and Distributing Applications

Abstract
Chapter 14 looked at Devices, Projects, and the Organizer. Together these elements of Xcode let you perform a vast array of actions, from managing iOS devices and project snapshots to preparing archives for submission to the App Store. This chapter continues that theme as you learn how to take your finished application and submit it for hosting on Apple’s App Store, the single storefront for both free and paid applications for iOS.
Matthew Knott
Additional information